Enum Body

Source
pub enum Body<W: FsTaskSpawner, C: FileServeConfig> {
    Full(Bytes),
    Chunked(ChunkedReadFile<W, C>),
}
Expand description

File serving body for hyper Service

Variants§

§

Full(Bytes)

Full

§

Chunked(ChunkedReadFile<W, C>)

Chunked file read

Implementations§

Source§

impl<W: FsTaskSpawner, C: FileServeConfig> Body<W, C>

Source

pub const fn empty() -> Self

Creates empty body

Source

pub fn poll_next( self: Pin<&mut Self>, ctx: &mut Context<'_>, ) -> Poll<Option<Result<Bytes, Error>>>

Method to fetch next chunk within Future interface

Source

pub fn is_finished(&self) -> bool

Returns whether body is finished to be served.

Source

pub fn len(&self) -> u64

Remaining length

Trait Implementations§

Source§

impl<W: FsTaskSpawner, C: FileServeConfig> Body for Body<W, C>

Source§

type Data = Bytes

Values yielded by the Body.
Source§

type Error = Error

The error type this Body might generate.
Source§

fn poll_frame( self: Pin<&mut Self>, ctx: &mut Context<'_>, ) -> Poll<Option<Result<Frame<Self::Data>, Self::Error>>>

Attempt to pull out the next data buffer of this stream.
Source§

fn is_end_stream(&self) -> bool

Returns true when the end of stream has been reached. Read more
Source§

fn size_hint(&self) -> SizeHint

Returns the bounds on the remaining length of the stream. Read more
Source§

impl<W: FsTaskSpawner, C: FileServeConfig> From<Bytes> for Body<W, C>

Source§

fn from(bytes: Bytes) -> Self

Converts to this type from the input type.
Source§

impl<W: FsTaskSpawner, C: FileServeConfig> From<ChunkedReadFile<W, C>> for Body<W, C>

Source§

fn from(chunked: ChunkedReadFile<W, C>) -> Self

Converts to this type from the input type.
Source§

impl<W: FsTaskSpawner, C: FileServeConfig> From<Option<ChunkedReadFile<W, C>>> for Body<W, C>

Source§

fn from(chunked: Option<ChunkedReadFile<W, C>>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<W, C> !Freeze for Body<W, C>

§

impl<W, C> RefUnwindSafe for Body<W, C>

§

impl<W, C> Send for Body<W, C>

§

impl<W, C> Sync for Body<W, C>
where <W as FsTaskSpawner>::FileReadFut: Sync, W: Sync, C: Sync,

§

impl<W, C> Unpin for Body<W, C>

§

impl<W, C> UnwindSafe for Body<W, C>

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> 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, 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.