pub struct Buffered<S, D = Backend> { /* private fields */ }Expand description
Transport wrapper which retains bytes until each write has completed.
Implementations§
Source§impl<S> Buffered<S, Backend>
impl<S> Buffered<S, Backend>
Sourcepub fn with_max_frame_len(io: S, max_frame_len: usize) -> Result<Self>
pub fn with_max_frame_len(io: S, max_frame_len: usize) -> Result<Self>
Creates a backend-facing transport with a bounded tagged-frame size.
§Errors
Returns an error when the limit is outside PostgreSQL’s frame range.
Source§impl<S> Buffered<S, Frontend>
impl<S> Buffered<S, Frontend>
Sourcepub fn new_frontend(io: S) -> Self
pub fn new_frontend(io: S) -> Self
Wraps a client-facing transport which receives frontend messages.
Sourcepub fn with_max_frame_len_frontend(io: S, max_frame_len: usize) -> Result<Self>
pub fn with_max_frame_len_frontend(io: S, max_frame_len: usize) -> Result<Self>
Creates a frontend-facing transport with a bounded tagged-frame size.
§Errors
Returns an error when the limit is outside PostgreSQL’s frame range.
Source§impl<S, D> Buffered<S, D>
impl<S, D> Buffered<S, D>
Source§impl<S: AsyncWrite + Unpin, D> Buffered<S, D>
impl<S: AsyncWrite + Unpin, D> Buffered<S, D>
Sourcepub async fn flush(&mut self) -> Result<()>
pub async fn flush(&mut self) -> Result<()>
Writes all buffered bytes without consuming the connection.
Completed partial writes are removed immediately. If this future is cancelled, the connection remains owned by the caller and all unwritten bytes remain buffered for the next call.
§Errors
Returns the underlying transport’s write error or WriteZero.
Source§impl<S: AsyncRead + Unpin, D: Direction> Buffered<S, D>
impl<S: AsyncRead + Unpin, D: Direction> Buffered<S, D>
Sourcepub async fn receive_wire(&mut self) -> Result<D::Message>
pub async fn receive_wire(&mut self) -> Result<D::Message>
Receives one typed message in this transport’s inbound direction.
§Errors
Returns decoding and underlying transport read errors, or UnexpectedEof.
Source§impl<S: AsyncRead + Unpin> Buffered<S, Frontend>
impl<S: AsyncRead + Unpin> Buffered<S, Frontend>
Sourcepub async fn receive_pre_startup(&mut self) -> Result<PreStartupMessage>
pub async fn receive_pre_startup(&mut self) -> Result<PreStartupMessage>
Receives one raw first packet before tagged frontend framing begins.
§Errors
Returns malformed pre-startup data and underlying transport read errors.
Source§impl<S: AsyncRead + Unpin> Buffered<S, Backend>
impl<S: AsyncRead + Unpin> Buffered<S, Backend>
Sourcepub async fn receive_backend(&mut self) -> Result<BackendMessage>
pub async fn receive_backend(&mut self) -> Result<BackendMessage>
Receives one decoded backend message while retaining partial input.
§Errors
Returns decoding and underlying transport read errors, or UnexpectedEof.
Sourcepub async fn receive_session(&mut self) -> Result<SessionItem>
pub async fn receive_session(&mut self) -> Result<SessionItem>
Receives the next protocol-advancing message through the async demux.
§Errors
Returns decoding and underlying transport read errors, or UnexpectedEof.
Sourcepub fn project_backend(
&mut self,
message: BackendMessage,
) -> Option<SessionItem>
pub fn project_backend( &mut self, message: BackendMessage, ) -> Option<SessionItem>
Projects an inspected or modified backend message into the session stream.