Skip to main content

Bytes

Struct Bytes 

Source
pub struct Bytes<S> { /* private fields */ }
Expand description

Bytes with a statically selected storage policy and no wrapper overhead.

Implementations§

Source§

impl<'a> Bytes<Borrowed<'a>>

Source

pub fn slice(self, range: Range<usize>) -> Bytes<Borrowed<'a>>

§Panics

Panics if range is reversed or out of bounds.

Source§

impl Bytes<Shared>

Source

pub fn into_shared(self) -> Shared

Source

pub fn slice(self, range: Range<usize>) -> Bytes<Shared>

§Panics

Panics if range is reversed or out of bounds.

Source§

impl Bytes<Retained>

Source

pub fn copy_from_slice(slice: &[u8]) -> Bytes<Retained>

Source

pub fn into_shared(self) -> Shared

Source

pub fn slice(self, range: Range<usize>) -> Bytes<Retained>

§Panics

Panics if range is reversed or out of bounds.

Source

pub fn advance(&mut self, n: usize)

§Panics

Panics if n exceeds the remaining length.

Source§

impl<S> Bytes<S>
where S: Storage,

Source

pub fn as_slice(&self) -> &[u8]

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source§

impl<S> Bytes<S>
where Bytes<S>: RetainBytes,

Trait Implementations§

Source§

impl<S> AsRef<[u8]> for Bytes<S>
where S: Storage,

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<S> ByteSpan for Bytes<S>
where S: Storage,

Source§

fn as_slice(&self) -> &[u8]

Source§

fn len(&self) -> usize

Source§

fn is_empty(&self) -> bool

Source§

impl<S> Clone for Bytes<S>
where S: Clone,

Source§

fn clone(&self) -> Bytes<S>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S> Copy for Bytes<S>
where S: Copy,

Source§

impl<S> Debug for Bytes<S>
where S: Storage,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<S> Eq for Bytes<S>
where S: Storage,

Source§

impl<'a, const N: usize> From<&'a [u8; N]> for Bytes<Borrowed<'a>>

Source§

fn from(value: &'a [u8; N]) -> Bytes<Borrowed<'a>>

Converts to this type from the input type.
Source§

impl<'a> From<&'a [u8]> for Bytes<Borrowed<'a>>

Source§

fn from(value: &'a [u8]) -> Bytes<Borrowed<'a>>

Converts to this type from the input type.
Source§

impl<'req> From<Bytes<Borrowed<'req>>> for Body<'req>

Source§

fn from(body: Bytes<Borrowed<'req>>) -> Self

Converts to this type from the input type.
Source§

impl<'req> From<Bytes<Borrowed<'req>>> for HeaderValueInner<'req>

Source§

fn from(value: Bytes<Borrowed<'req>>) -> Self

Converts to this type from the input type.
Source§

impl<'req> From<Bytes<Retained>> for Body<'req>

Source§

fn from(body: Bytes<Retained>) -> Self

Converts to this type from the input type.
Source§

impl<'req> From<Bytes<Retained>> for HeaderValueInner<'req>

Source§

fn from(value: Bytes<Retained>) -> Self

Converts to this type from the input type.
Source§

impl From<Pooled> for Bytes<Leased>

Source§

fn from(value: Pooled) -> Bytes<Leased>

Converts to this type from the input type.
Source§

impl From<Pooled> for Bytes<Retained>

Source§

fn from(value: Pooled) -> Bytes<Retained>

Converts to this type from the input type.
Source§

impl From<Shared> for Bytes<Shared>

Source§

fn from(value: Shared) -> Bytes<Shared>

Converts to this type from the input type.
Source§

impl From<Shared> for Bytes<Retained>

Source§

fn from(value: Shared) -> Bytes<Retained>

Converts to this type from the input type.
Source§

impl<S> Hash for Bytes<S>
where S: Storage,

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<S> PartialEq for Bytes<S>
where S: Storage,

Source§

fn eq(&self, other: &Bytes<S>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl RetainBytes for Bytes<Borrowed<'_>>

Source§

impl RetainBytes for Bytes<Leased>

Source§

impl RetainBytes for Bytes<Shared>

Source§

impl RetainBytes for Bytes<Retained>

Auto Trait Implementations§

§

impl<S> Freeze for Bytes<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for Bytes<S>
where S: RefUnwindSafe,

§

impl<S> Send for Bytes<S>
where S: Send,

§

impl<S> Sync for Bytes<S>
where S: Sync,

§

impl<S> Unpin for Bytes<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for Bytes<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for Bytes<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.