Skip to main content

Ref

Struct Ref 

Source
pub struct Ref<'req, 'd> { /* private fields */ }
Expand description

Borrowed logical body preserving transport segmentation.

Implementations§

Source§

impl<'req, 'd> Ref<'req, 'd>

Source

pub const fn from_slice(bytes: &'req [u8]) -> Self

Classifies an empty view or one nonempty borrowed segment.

Source

pub const fn len(&self) -> usize

Source

pub const fn is_empty(&self) -> bool

Source

pub fn count(&self) -> Count

Source

pub fn segment(&self, index: usize) -> Option<&'req [u8]>

Source

pub fn segments(self) -> Slices<'req, 'd> ⓘ

Source

pub fn as_slice(&self) -> Option<&'req [u8]>

Source

pub fn try_copy(self) -> Result<Shared, Error>

Copies the logical body into one exact shared owner.

Trait Implementations§

Source§

impl<'src, 'd> Body<'d> for Ref<'src, 'd>

Source§

fn len(&self) -> usize

Source§

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

Source§

fn segments(&self) -> impl ExactSizeIterator<Item = &[u8]> + FusedIterator

Source§

fn is_empty(&self) -> bool

Source§

impl<'req, 'd> Clone for Ref<'req, 'd>

Source§

fn clone(&self) -> Self

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<'req, 'd> Copy for Ref<'req, 'd>

Source§

impl<'req, 'd> Debug for Ref<'req, 'd>

Source§

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

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

impl<'req, 'd> From<&'req Segments<'d>> for Ref<'req, 'd>

Source§

fn from(body: &'req Segments<'d>) -> Self

Converts to this type from the input type.
Source§

impl<'req, 'd> From<View<'req, 'd>> for Ref<'req, 'd>

Source§

fn from(view: View<'req, 'd>) -> Self

Converts to this type from the input type.
Source§

impl<'req, 'd> Source<'d> for Ref<'req, 'd>

Source§

type Body<'a> = Ref<'a, 'd>
where Self: 'a, 'd: 'a,

Source§

fn try_project<V, T>( &mut self, value: V, project: impl for<'a> FnOnce(V, View<'a, 'd>) -> T, ) -> Result<T, (V, Error)>

Source§

fn body<'a>(&'a self) -> Self::Body<'a>
where 'd: 'a,

Auto Trait Implementations§

§

impl<'req, 'd> !RefUnwindSafe for Ref<'req, 'd>

§

impl<'req, 'd> !Send for Ref<'req, 'd>

§

impl<'req, 'd> !Sync for Ref<'req, 'd>

§

impl<'req, 'd> !UnwindSafe for Ref<'req, 'd>

§

impl<'req, 'd> Freeze for Ref<'req, 'd>

§

impl<'req, 'd> Unpin for Ref<'req, 'd>

§

impl<'req, 'd> UnsafeUnpin for Ref<'req, 'd>

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> Convert<T> for T

Source§

fn into(self) -> T

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.