pub struct MessageReader { /* private fields */ }Expand description
Incremental reader for PostgreSQL backend messages.
Implementations§
Source§impl MessageReader
impl MessageReader
Sourcepub fn with_max_size(max_message_size: usize) -> Self
pub fn with_max_size(max_message_size: usize) -> Self
Create a new reader with a custom max message size.
Sourcepub fn buffered_len(&self) -> usize
pub fn buffered_len(&self) -> usize
Number of bytes currently buffered.
Sourcepub fn feed(
&mut self,
data: &[u8],
) -> Result<Vec<BackendMessage>, ProtocolError>
pub fn feed( &mut self, data: &[u8], ) -> Result<Vec<BackendMessage>, ProtocolError>
Feed bytes into the reader and return any complete messages.
Sourcepub fn next_message(&mut self) -> Result<Option<BackendMessage>, ProtocolError>
pub fn next_message(&mut self) -> Result<Option<BackendMessage>, ProtocolError>
Attempt to parse the next message from the internal buffer.
Sourcepub fn parse_message(frame: &[u8]) -> Result<BackendMessage, ProtocolError>
pub fn parse_message(frame: &[u8]) -> Result<BackendMessage, ProtocolError>
Parse a single full message frame (type + length + payload).
Trait Implementations§
Source§impl Clone for MessageReader
impl Clone for MessageReader
Source§fn clone(&self) -> MessageReader
fn clone(&self) -> MessageReader
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MessageReader
impl Debug for MessageReader
Auto Trait Implementations§
impl Freeze for MessageReader
impl RefUnwindSafe for MessageReader
impl Send for MessageReader
impl Sync for MessageReader
impl Unpin for MessageReader
impl UnwindSafe for MessageReader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).