Beast Logo

PrevUpHomeNext

FieldsReader

A FieldsReader provides a algorithm to obtain a sequence of buffers representing the complete serialized HTTP/1 header for a set of fields. The implementation constructs an instance of this type when needed, and calls into it once to retrieve the buffers.

Associated Types
Requirements

In this table:

Table 35. Valid expressions

expression

type

semantics, pre/post-conditions

R::const_buffers_type

A type which meets the requirements of ConstBufferSequence. This is the type of buffer returned by R::get.

R(f,v,m)

The implementation calls this constructor to indicate that the fields being serialized form part of an HTTP request. The lifetime of f is guaranteed to end no earlier than after the R is destroyed.

R(f,v,c)

The implementation calls this constructor to indicate that the fields being serialized form part of an HTTP response. The lifetime of f is guaranteed to end no earlier than after the R is destroyed.

a.get()

R::const_buffers_type

Called once after construction, this function returns a constant buffer sequence containing the serialized representation of the HTTP request or response including the final carriage return linefeed sequence ("\r\n").


Exemplar
struct FieldsReader
{
    // The type of buffers returned by `get`
    struct const_buffers_type;

    // Constructor for requests
    FieldsReader(F const& f, unsigned version, verb method);

    // Constructor for responses
    FieldsReader(F const& f, unsigned version, unsigned status);

    // Returns `true` if keep-alive is indicated
    bool
    keep_alive();

    // Returns the serialized header buffers
    const_buffers_type
    get();
};
Models

PrevUpHomeNext