[−][src]Struct esl01_minibytes::Bytes
Immutable bytes with zero-copy slicing and cloning.
Methods
impl Bytes
[src]
pub fn slice(&self, range: impl RangeBounds<usize>) -> Self
[src]
Returns a slice of self for the provided range.
This operation is O(1)
.
pub fn slice_to_bytes(&self, slice: &[u8]) -> Self
[src]
Attempt to convert slice
to a zero-copy slice of this Bytes
.
Copy the slice
if zero-copy cannot be done.
This is similar to bytes::Bytes::slice_ref
from bytes 0.5.4
,
but does not panic.
pub fn range_of_slice(&self, slice: &[u8]) -> Option<Range<usize>>
[src]
Return a range x
so that self[x]
matches slice
exactly
(not only content, but also internal pointer addresses).
Returns None
if slice
is outside the memory range of this
Bytes
.
This operation is O(1)
.
pub fn new() -> Self
[src]
Creates an empty Bytes
.
pub fn from_static(value: &'static [u8]) -> Self
[src]
Creates Bytes
from a static slice.
pub fn from_owner(value: impl BytesOwner) -> Self
[src]
Creates Bytes
from a BytesOwner
(for example, Vec<u8>
).
pub fn copy_from_slice(data: &[u8]) -> Self
[src]
Creates Bytes
instance from slice, by copying it.
Trait Implementations
impl AsRef<[u8]> for Bytes
[src]
impl Borrow<[u8]> for Bytes
[src]
impl Clone for Bytes
[src]
impl Debug for Bytes
[src]
impl Default for Bytes
[src]
impl Deref for Bytes
[src]
impl<'de> Deserialize<'de> for Bytes
[src]
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
[src]
impl Eq for Bytes
[src]
impl<T: BytesOwner> From<T> for Bytes
[src]
impl Hash for Bytes
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Bytes
[src]
fn cmp(&self, other: &Bytes) -> Ordering
[src]
#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: AsRef<[u8]>> PartialEq<T> for Bytes
[src]
impl<T: AsRef<[u8]>> PartialOrd<T> for Bytes
[src]
fn partial_cmp(&self, other: &T) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Send for Bytes
[src]
impl Serialize for Bytes
[src]
impl Sync for Bytes
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,