pub trait ByteBuf: Buf {
Show 13 methods fn peek_bytes(&mut self, r: Range<usize>) -> Bytes; fn get_bytes(&mut self, size: usize) -> Bytes; fn try_peek_bytes(
        &mut self,
        r: Range<usize>
    ) -> Result<Bytes, NotEnoughBytesError> { ... } fn try_get_bytes(
        &mut self,
        size: usize
    ) -> Result<Bytes, NotEnoughBytesError> { ... } fn try_copy_to_slice(
        &mut self,
        dst: &mut [u8]
    ) -> Result<(), NotEnoughBytesError> { ... } fn try_get_u8(&mut self) -> Result<u8, NotEnoughBytesError> { ... } fn try_get_u16(&mut self) -> Result<u16, NotEnoughBytesError> { ... } fn try_get_u32(&mut self) -> Result<u32, NotEnoughBytesError> { ... } fn try_get_i8(&mut self) -> Result<i8, NotEnoughBytesError> { ... } fn try_get_i16(&mut self) -> Result<i16, NotEnoughBytesError> { ... } fn try_get_i32(&mut self) -> Result<i32, NotEnoughBytesError> { ... } fn try_get_i64(&mut self) -> Result<i64, NotEnoughBytesError> { ... } fn try_get_f64(&mut self) -> Result<f64, NotEnoughBytesError> { ... }
}
Expand description

Extension for working with bytes::Buf.

Required Methods§

Peek ahead in the buffer by the provided range.

Get size bytes from the underlying buffer.

Provided Methods§

Try to peek ahead in the buffer bu the provided range, returning an error if there are less bytes than the requested range.

Try to get size bytes from the buffer, returning an error if there are less bytes than the requested number.

Attempt to copy from buffer into destination slice, returning an error if not enough space remains.

Attempt to read a u8 from the buffer, returning an error if not enough space remains.

Attempt to read a u16 from the buffer, returning an error if not enough space remains.

Attempt to read a u32 from the buffer, returning an error if not enough space remains.

Attempt to read a i8 from the buffer, returning an error if not enough space remains.

Attempt to read a i16 from the buffer, returning an error if not enough space remains.

Attempt to read a i32 from the buffer, returning an error if not enough space remains.

Attempt to read a i64 from the buffer, returning an error if not enough space remains.

Attempt to read a f32 from the buffer, returning an error if not enough space remains.

Implementations on Foreign Types§

Implementors§