[][src]Trait httpbis::BufGetBytes

pub trait BufGetBytes: Buf {
    fn get_bytes(&mut self, cnt: usize) -> Bytes { ... }
}

Get Bytes from Buf.

Provided methods

fn get_bytes(&mut self, cnt: usize) -> Bytes

Consumes requested number of bytes from self.

Examples

use bytes::Buf;
use httpbis::BufGetBytes;

let bytes = (&b"hello world"[..]).get_bytes(5);
assert_eq!(&bytes[..], &b"hello"[..]);

Panics

This function panics if there is not enough remaining data in self.

Loading content...

Implementations on Foreign Types

impl BufGetBytes for Bytes[src]

impl BufGetBytes for BytesMut[src]

impl<'_> BufGetBytes for &'_ [u8][src]

impl<A: AsRef<[u8]>> BufGetBytes for Cursor<A>[src]

impl<A: BufGetBytes, B: BufGetBytes> BufGetBytes for Chain<A, B>[src]

impl<A: BufGetBytes> BufGetBytes for Take<A>[src]

impl<'_, A: BufGetBytes> BufGetBytes for &'_ mut A[src]

Loading content...

Implementors

impl BufGetBytes for BytesDeque[src]

Loading content...