pub struct BufferWriter { /* private fields */ }Expand description
Buffer writer for creating binary protocol messages
This implementation uses BytesMut from the bytes crate for efficient buffer operations.
Implementations§
Source§impl BufferWriter
impl BufferWriter
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a new buffer writer with specified capacity
Sourcepub fn bytes_written(&self) -> usize
pub fn bytes_written(&self) -> usize
Get bytes written so far
Sourcepub fn write_u16(&mut self, value: u16) -> Result<()>
pub fn write_u16(&mut self, value: u16) -> Result<()>
Write a 16-bit unsigned integer in network byte order
Sourcepub fn write_i16(&mut self, value: i16) -> Result<()>
pub fn write_i16(&mut self, value: i16) -> Result<()>
Write a 16-bit signed integer in network byte order
Sourcepub fn write_u32(&mut self, value: u32) -> Result<()>
pub fn write_u32(&mut self, value: u32) -> Result<()>
Write a 32-bit unsigned integer in network byte order
Sourcepub fn write_u64(&mut self, value: u64) -> Result<()>
pub fn write_u64(&mut self, value: u64) -> Result<()>
Write a 64-bit unsigned integer in network byte order
Sourcepub fn write_i32(&mut self, value: i32) -> Result<()>
pub fn write_i32(&mut self, value: i32) -> Result<()>
Write a 32-bit signed integer in network byte order
Sourcepub fn write_i64(&mut self, value: i64) -> Result<()>
pub fn write_i64(&mut self, value: i64) -> Result<()>
Write a 64-bit signed integer in network byte order
Sourcepub fn write_bytes(&mut self, bytes: &[u8]) -> Result<()>
pub fn write_bytes(&mut self, bytes: &[u8]) -> Result<()>
Write raw bytes
Sourcepub fn write_cstring(&mut self, s: &str) -> Result<()>
pub fn write_cstring(&mut self, s: &str) -> Result<()>
Write a null-terminated string
Rejects strings containing embedded null bytes, which would produce malformed PostgreSQL protocol messages (the null byte is the terminator).
Sourcepub fn write_string(&mut self, s: &str) -> Result<()>
pub fn write_string(&mut self, s: &str) -> Result<()>
Write a string without null terminator
Trait Implementations§
Source§impl AsRef<[u8]> for BufferWriter
impl AsRef<[u8]> for BufferWriter
Auto Trait Implementations§
impl Freeze for BufferWriter
impl RefUnwindSafe for BufferWriter
impl Send for BufferWriter
impl Sync for BufferWriter
impl Unpin for BufferWriter
impl UnsafeUnpin for BufferWriter
impl UnwindSafe for BufferWriter
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