pub struct MessageBuilder<'a> { /* private fields */ }Expand description
Message builder helper that handles the length field.
PostgreSQL message format:
- Type byte (1 byte) - NOT included in length
- Length (4 bytes) - includes itself
- Payload (Length - 4 bytes)
Implementations§
Source§impl<'a> MessageBuilder<'a>
impl<'a> MessageBuilder<'a>
Sourcepub fn new(buf: &'a mut Vec<u8>, type_byte: u8) -> Self
pub fn new(buf: &'a mut Vec<u8>, type_byte: u8) -> Self
Start building a message with a type byte.
Sourcepub fn new_startup(buf: &'a mut Vec<u8>) -> Self
pub fn new_startup(buf: &'a mut Vec<u8>) -> Self
Start building a startup message (no type byte).
Sourcepub fn write_bytes(&mut self, data: &[u8])
pub fn write_bytes(&mut self, data: &[u8])
Write raw bytes.
Sourcepub fn write_cstr(&mut self, s: &str)
pub fn write_cstr(&mut self, s: &str)
Write null-terminated string.
Auto Trait Implementations§
impl<'a> Freeze for MessageBuilder<'a>
impl<'a> RefUnwindSafe for MessageBuilder<'a>
impl<'a> Send for MessageBuilder<'a>
impl<'a> Sync for MessageBuilder<'a>
impl<'a> Unpin for MessageBuilder<'a>
impl<'a> !UnwindSafe for MessageBuilder<'a>
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