pub struct ReadBuffer { /* private fields */ }
Expand description
A buffer for reading codec data with safety checks
Implementations§
Source§impl ReadBuffer
impl ReadBuffer
Sourcepub fn read_varint(&mut self) -> Result<u64, Error>
pub fn read_varint(&mut self) -> Result<u64, Error>
Reads a varint-encoded unsigned integer
Sourcepub fn has_remaining(&self) -> bool
pub fn has_remaining(&self) -> bool
Checks if the buffer has any remaining bytes
Sourcepub fn at_least(&self, size: usize) -> Result<(), Error>
pub fn at_least(&self, size: usize) -> Result<(), Error>
Ensures the buffer has at least size
bytes remaining
pub fn get_u16(&mut self) -> Result<u16, Error>
pub fn get_u32(&mut self) -> Result<u32, Error>
pub fn get_u64(&mut self) -> Result<u64, Error>
pub fn get_u128(&mut self) -> Result<u128, Error>
pub fn get_i8(&mut self) -> Result<i8, Error>
pub fn get_i16(&mut self) -> Result<i16, Error>
pub fn get_i32(&mut self) -> Result<i32, Error>
pub fn get_i64(&mut self) -> Result<i64, Error>
pub fn get_i128(&mut self) -> Result<i128, Error>
pub fn get_f32(&mut self) -> Result<f32, Error>
pub fn get_f64(&mut self) -> Result<f64, Error>
pub fn copy_to_slice(&mut self, dst: &mut [u8]) -> Result<(), Error>
pub fn split_to(&mut self, size: usize) -> Result<Bytes, Error>
Trait Implementations§
Source§impl Debug for ReadBuffer
impl Debug for ReadBuffer
Source§impl Reader for ReadBuffer
impl Reader for ReadBuffer
Auto Trait Implementations§
impl !Freeze for ReadBuffer
impl RefUnwindSafe for ReadBuffer
impl Send for ReadBuffer
impl Sync for ReadBuffer
impl Unpin for ReadBuffer
impl UnwindSafe for ReadBuffer
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