pub struct Bytes(/* private fields */);Implementations§
Source§impl 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 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§
Source§impl<'de> Deserialize<'de> for Bytes
impl<'de> Deserialize<'de> for Bytes
Source§fn 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
Source§impl From<PacketKind> for Bytes
impl From<PacketKind> for Bytes
Source§fn from(value: PacketKind) -> Self
fn from(value: PacketKind) -> Self
Converts to this type from the input type.
Source§impl FromIterator<u8> for Bytes
impl FromIterator<u8> for Bytes
Source§impl IntoIterator for Bytes
impl IntoIterator for Bytes
Source§impl TryFrom<Bytes> for PacketKind
impl TryFrom<Bytes> for PacketKind
impl StructuralPartialEq for Bytes
Auto Trait Implementations§
impl Freeze for Bytes
impl RefUnwindSafe for Bytes
impl Send for Bytes
impl Sync for Bytes
impl Unpin for Bytes
impl UnwindSafe for Bytes
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more