Struct pgwire::codec::FramedConn[][src]

pub struct FramedConn<A> {
    conn_id: u32,
    inner: Buffer<Framed<Conn<A>, Codec>, BackendMessage>,
}
Expand description

A connection that manages the encoding and decoding of pgwire frames.

Fields

conn_id: u32inner: Buffer<Framed<Conn<A>, Codec>, BackendMessage>

Implementations

Constructs a new framed connection.

The underlying connection, inner, is expected to be something like a TCP stream. Anything that implements AsyncRead and AsyncWrite will do.

The supplied conn_id is used to identify the connection in logging messages.

Returns the ID of this connection.

Reads and decodes one frontend message from the client.

Blocks until the client sends a complete message. If the client terminates the stream, returns None. Returns an error if the client sends a malformatted message or if the connection underlying is broken.

Encodes and sends one backend message to the client.

Note that the connection is not flushed after calling this method. You must call FramedConn::flush explicitly. Returns an error if the underlying connection is broken.

Encodes and sends the backend messages in the messages iterator to the client.

As with FramedConn::send, the connection is not flushed after calling this method. You must call FramedConn::flush explicitly. Returns an error if the underlying connection is broken.

Flushes all outstanding messages.

Injects state that affects how certain backend messages are encoded.

Specifically, the encoding of BackendMessage::DataRow depends upon the types of the datums in the row. To avoid including the same type information in each message, we use this side channel to install the type information in the codec before sending any data row messages. This violates the abstraction boundary a bit but results in much better performance.

Trait Implementations

Checks for IO readiness. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more