pub trait ByteParsing {
// Required methods
fn delimited(&mut self, delimiter: u8) -> Option<BytesMut>;
fn safe_split_to(&mut self, at: usize) -> Option<BytesMut>;
fn safe_split_off(&mut self, at: usize) -> Option<BytesMut>;
fn safe_get_u8(&mut self) -> Option<u8>;
fn safe_get_u32(&mut self) -> Option<u32>;
}
Expand description
Safe extensions to methods from bytes::BytesMut
.
Required Methods§
Sourcefn delimited(&mut self, delimiter: u8) -> Option<BytesMut>
fn delimited(&mut self, delimiter: u8) -> Option<BytesMut>
Split at the given delimiter.
Return the split off bytes without the delimiter
Sourcefn safe_split_to(&mut self, at: usize) -> Option<BytesMut>
fn safe_split_to(&mut self, at: usize) -> Option<BytesMut>
Bounds checked variant of bytes::BytesMut::split_to
Sourcefn safe_split_off(&mut self, at: usize) -> Option<BytesMut>
fn safe_split_off(&mut self, at: usize) -> Option<BytesMut>
Bounds checked variant of bytes::BytesMut::split_off
Sourcefn safe_get_u8(&mut self) -> Option<u8>
fn safe_get_u8(&mut self) -> Option<u8>
Bounds checked variant of bytes::BytesMut::get_u8
Sourcefn safe_get_u32(&mut self) -> Option<u32>
fn safe_get_u32(&mut self) -> Option<u32>
Bounds checked variant of bytes::BytesMut::get_u32