Struct Fuse

pub struct Fuse<B> { /* private fields */ }

A "fused" Body.

This Body yields Poll::Ready(None) forever after the underlying body yields Poll::Ready(None), or an error Poll::Ready(Some(Err(_))), once.

Bodies should ideally continue to return Poll::Ready(None) indefinitely after the end of the stream is reached. [Fuse<B>] avoids polling its underlying body B further after the underlying stream as ended, which can be useful for implementation that cannot uphold this guarantee.

This is akin to the functionality that [std::iter::Iterator::fuse()] provides for [Iterator][std::iter::Iterator]s.

Implementations

impl<B> Fuse<B> where B: Body,

fn new(body: B) -> Self

Returns a fused body.

Trait Implementations

impl<B> Body for Fuse<B> where B: Body + Unpin,

type Data = <B as Body>::Data;
type Error = <B as Body>::Error;
fn poll_frame(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Result<Frame<B::Data>, B::Error>>>
fn is_end_stream(&self) -> bool
fn size_hint(&self) -> SizeHint

impl<B: Debug> Debug for Fuse<B>

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

Auto Trait Implementations

impl<B> Freeze for Fuse<B> where Option<B>: Freeze,

impl<B> RefUnwindSafe for Fuse<B> where Option<B>: RefUnwindSafe,

impl<B> Send for Fuse<B> where Option<B>: Send,

impl<B> Sync for Fuse<B> where Option<B>: Sync,

impl<B> Unpin for Fuse<B> where Option<B>: Unpin,

impl<B> UnsafeUnpin for Fuse<B> where Option<B>: UnsafeUnpin,

impl<B> UnwindSafe for Fuse<B> where Option<B>: UnwindSafe,

Blanket Implementations

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

fn type_id(&self) -> TypeId

impl<T> BodyExt for Fuse<B> where T: Body + ?Sized,

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

fn borrow(&self) -> &T

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

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

impl<T> From<T> for Fuse<B>

fn from(t: T) -> T

Returns the argument unchanged.

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

fn into(self) -> U

Calls U::from(self).

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

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

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