Skip to main content

Bytes

Struct Bytes 

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

Contiguous bytes derived from one exact request.

Projection cannot extend the request owner’s lifetime.

Implementations§

Source§

impl<'d> Bytes<'d>

Source

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

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn into_inner(self) -> Shared<State<'d>>

Source

pub fn project( self, visible: Range<usize>, ) -> Result<Self, Rejected<Self, Error>>

Narrows this request owner, retaining its identity on success and rejection.

Trait Implementations§

Source§

impl AsRef<[u8]> for Bytes<'_>

Source§

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

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

impl<'d, Ranges: Copy + 'd> Body<'d, Ranges> for Bytes<'d>

Source§

type Bound = Unbounded

Source§

type Storage = (Id<'d>, NonEmpty<Shared<State<'d>>>)

Source§

type Prepared = Option<<Bytes<'d> as Body<'d, Ranges>>::Storage>

Source§

fn len(&self) -> usize

Source§

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

Source§

fn is_empty(&self) -> bool

Source§

fn segments(&self) -> impl FusedIterator<Item: AsRef<[u8]>>

Source§

impl Bytes for Bytes<'_>

Source§

fn as_bytes(&self) -> &[u8] ⓘ

Auto Trait Implementations§

§

impl<'d> !RefUnwindSafe for Bytes<'d>

§

impl<'d> !Send for Bytes<'d>

§

impl<'d> !Sync for Bytes<'d>

§

impl<'d> !UnwindSafe for Bytes<'d>

§

impl<'d> Forget for Bytes<'d>

§

impl<'d> Freeze for Bytes<'d>
where *const () is !null: Freeze, *const Header<Budget<'d>> is !null: Freeze, PhantomData<(Header<Budget<'d>>, u32)>: Freeze, *const Account<'d> is !null: Freeze, PhantomData<(Account<'d>, u32)>: Freeze, *const Registration<'d> is !null: Freeze, PhantomData<(Registration<'d>, u32)>: Freeze, *const Registration<'d, ()> is !null: Freeze, PhantomData<(Registration<'d, ()>, u32)>: Freeze, *const [u8] is !null: Freeze, NonZero<u64>: Freeze, PhantomData<(fn(&'d ()) -> &'d (), ThreadBound)>: Freeze, PhantomData<*mut ()>: Freeze,

§

impl<'d> Move for Bytes<'d>

§

impl<'d> Unpin for Bytes<'d>
where *const () is !null: Unpin, Owner<Header<Budget<'d>>>: Unpin, Owner<Account<'d>>: Unpin, Owner<Registration<'d>>: Unpin, Owner<Registration<'d, ()>>: Unpin, *const [u8] is !null: Unpin, NonZero<u64>: Unpin, *mut (): Unpin,

§

impl<'d> UnsafeUnpin for Bytes<'d>
where *const () is !null: UnsafeUnpin, *const Header<Budget<'d>> is !null: UnsafeUnpin, PhantomData<(Header<Budget<'d>>, u32)>: UnsafeUnpin, *const Account<'d> is !null: UnsafeUnpin, PhantomData<(Account<'d>, u32)>: UnsafeUnpin, *const Registration<'d> is !null: UnsafeUnpin, PhantomData<(Registration<'d>, u32)>: UnsafeUnpin, *const Registration<'d, ()> is !null: UnsafeUnpin, PhantomData<(Registration<'d, ()>, u32)>: UnsafeUnpin, *const [u8] is !null: UnsafeUnpin, NonZeroU64Inner: UnsafeUnpin, PhantomData<(fn(&'d ()) -> &'d (), ThreadBound)>: UnsafeUnpin, PhantomData<*mut ()>: UnsafeUnpin,

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<L, R> Convert<Either<L, R>, 1> for L

Source§

fn into(self) -> Either<L, R>

Source§

unsafe fn take_into(source: *mut Self, place: &mut MaybeUninit<T>)
where Self: Sized,

Safety Read more
Source§

impl<L, R> Convert<Either<L, R>, 2> for R

Source§

fn into(self) -> Either<L, R>

Source§

unsafe fn take_into(source: *mut Self, place: &mut MaybeUninit<T>)
where Self: Sized,

Safety Read more
Source§

impl<T> Convert<T> for T

Source§

fn into(self) -> T

Source§

unsafe fn take_into(source: *mut Self, place: &mut MaybeUninit<T>)
where Self: Sized,

Safety Read more
Source§

impl<'req, 'd, Ranges, D, B> Emit<'req, 'd, D, Ranges> for B
where Ranges: Copy + 'd, D: Success, B: Body<'d, Ranges>,

Source§

const BODY: Kind = const BODY: payload::Kind = payload::Kind::Inline;

Source§

type Kind = Sync

Source§

type Stream = Never

Source§

type Bound = <B as Body<'d, Ranges>>::Bound

Source§

fn consume<W>( self, writer: W, ) -> <W as Transaction<'req, 'd, Never, Ranges>>::Done
where W: Transaction<'req, 'd, Never, Ranges>,

Source§

const DECLARED: Option<Head<Self>> = None

Source§

fn into_exact(self) -> Result<impl Reply, Self>

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<S> Source<Polled> for S

Source§

fn length(&self) -> u64

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.