pub struct Header { /* private fields */ }Expand description
Message header information.
PostgreSQL wire protocol messages start with a 5-byte header:
- 1 byte: message type tag
- 4 bytes: message length (
BigEndian, including the length field itself)
Implementations§
Source§impl Header
impl Header
Sourcepub fn parse(buf: &[u8]) -> Result<Option<Header>>
pub fn parse(buf: &[u8]) -> Result<Option<Header>>
Parses a message header from a buffer.
Returns Ok(None) if the buffer is too short (< 5 bytes).
Returns Err if the parsed length is invalid (< 4).
§Arguments
buf- Buffer containing at least the first 5 bytes of a message
§Errors
Returns io::ErrorKind::InvalidData if the parsed length field
is less than 4 (which is the minimum valid length — the 4-byte
length field itself).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnsafeUnpin for Header
impl UnwindSafe for Header
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: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request