Skip to main content

InspectChunksAsync

Struct InspectChunksAsync 

Source
pub struct InspectChunksAsync<F, Fut>
where F: FnMut(Chunk) -> Fut + Send + 'static, Fut: Future<Output = Next> + Send + 'static,
{ pub f: F, pub _fut: PhantomData<fn() -> Fut>, }
Expand description

Asynchronous counterpart to InspectChunks. Construct via builder and pass to Consumable::consume_async.

Fields§

§f: F

Per-chunk async callback. The returned future yields Next::Break to stop early.

§_fut: PhantomData<fn() -> Fut>

Phantom marker so the Fut bound lives on the struct (and on the derived builder) rather than only on the impl block. The closure’s return type carries Fut, so the builder infers it from f. Users never spell Fut out.

Implementations§

Source§

impl<F, Fut> InspectChunksAsync<F, Fut>
where F: FnMut(Chunk) -> Fut + Send + 'static, Fut: Future<Output = Next> + Send + 'static,

Source

pub fn builder() -> InspectChunksAsyncBuilder<F, Fut, ((),)>

Create a builder for building InspectChunksAsync. On the builder, call .f(...) to set the values of the fields. Finally, call .build() to create the instance of InspectChunksAsync.

Trait Implementations§

Source§

impl<F, Fut> AsyncStreamVisitor for InspectChunksAsync<F, Fut>
where F: FnMut(Chunk) -> Fut + Send + 'static, Fut: Future<Output = Next> + Send + 'static,

Source§

type Output = ()

The value produced by into_output after the visitor has finished observing the stream. Returned via Consumer::wait and Consumer::cancel.
Source§

fn on_chunk(&mut self, chunk: Chunk) -> impl Future<Output = Next> + Send + '_

Asynchronously observes a single chunk. Read more
Source§

fn into_output(self) -> Self::Output

Consumes the visitor and returns its final output. Read more
Source§

fn on_gap(&mut self)

Invoked when the stream backend reports that one or more chunks were dropped between the last delivered chunk and the next one. Read more
Source§

fn on_eof(&mut self) -> impl Future<Output = ()> + Send + '_

Asynchronously observes end-of-stream. Read more

Auto Trait Implementations§

§

impl<F, Fut> Freeze for InspectChunksAsync<F, Fut>
where F: Freeze,

§

impl<F, Fut> RefUnwindSafe for InspectChunksAsync<F, Fut>
where F: RefUnwindSafe,

§

impl<F, Fut> Send for InspectChunksAsync<F, Fut>

§

impl<F, Fut> Sync for InspectChunksAsync<F, Fut>
where F: Sync,

§

impl<F, Fut> Unpin for InspectChunksAsync<F, Fut>
where F: Unpin,

§

impl<F, Fut> UnsafeUnpin for InspectChunksAsync<F, Fut>
where F: UnsafeUnpin,

§

impl<F, Fut> UnwindSafe for InspectChunksAsync<F, Fut>
where F: 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Sink for T
where T: Send + 'static,