pub struct Bytes(_);
Implementations
sourceimpl Bytes
impl Bytes
sourcepub fn empty() -> Self
pub fn empty() -> Self
Creates a new empty Bytes.
Usually declared as mutable and filled later.
sourcepub fn as_slice(&self) -> &[u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
pub fn as_slice(&self) -> &[u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
Returns an immutable slice of bytes
.
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns if Self
is empty.
Wrapper around Vec::is_empty.
sourcepub fn append(&mut self, other: &mut Bytes)
pub fn append(&mut self, other: &mut Bytes)
Moves all elements of other
into Self
, leaving other
empty.
Wrapper around Vec::append.
sourcepub fn find_pattern(&self, pattern: &Bytes) -> Option<Vec<usize>>
pub fn find_pattern(&self, pattern: &Bytes) -> Option<Vec<usize>>
Returns indexes
on which provided pattern starts.
sourcepub fn split_at_pat(self, pattern: &Bytes) -> Vec<Bytes>
pub fn split_at_pat(self, pattern: &Bytes) -> Vec<Bytes>
Splits self
at provided pattern
which is not included in final result.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Bytes
impl<'de> Deserialize<'de> for Bytes
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<PacketKind> for Bytes
impl From<PacketKind> for Bytes
sourcefn from(value: PacketKind) -> Self
fn from(value: PacketKind) -> Self
Converts to this type from the input type.
sourceimpl FromIterator<u8> for Bytes
impl FromIterator<u8> for Bytes
sourcefn from_iter<T: IntoIterator<Item = u8>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = u8>>(iter: T) -> Self
Creates a value from an iterator. Read more
sourceimpl IntoIterator for Bytes
impl IntoIterator for Bytes
sourceimpl TryFrom<Bytes> for PacketKind
impl TryFrom<Bytes> for PacketKind
impl StructuralPartialEq for Bytes
Auto Trait Implementations
impl RefUnwindSafe for Bytes
impl Send for Bytes
impl Sync for Bytes
impl Unpin for Bytes
impl UnwindSafe for Bytes
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more