Struct MustComplete

Source
pub struct MustComplete<T> { /* private fields */ }
Expand description

Make sure that a future or stream will complete, created by CompletionFutureExt::must_complete and CompletionStreamExt::must_complete.

This wraps a CompletionFuture or CompletionStream and will ignore all requests to cancel it, enforcing that it will complete.

Implementations§

Source§

impl<T> MustComplete<T>

Source

pub unsafe fn into_inner(self) -> T

Take the inner item.

§Safety

This value must not be cancelled with CompletionFuture::poll_cancel or CompletionStream::poll_cancel.

Trait Implementations§

Source§

impl<T: Clone> Clone for MustComplete<T>

Source§

fn clone(&self) -> MustComplete<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: CompletionFuture> CompletionFuture for MustComplete<T>

Source§

type Output = <T as CompletionFuture>::Output

The type of value produced on completion.
Source§

unsafe fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>

Attempt to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. Read more
Source§

unsafe fn poll_cancel(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()>

Attempt to cancel the future, registering the current task for wakeup if has not finished cancelling yet. Read more
Source§

impl<T: CompletionStream> CompletionStream for MustComplete<T>

Source§

type Item = <T as CompletionStream>::Item

Values yielded by the stream.
Source§

unsafe fn poll_next( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Option<Self::Item>>

Attempt to pull out the next value of this stream, registering the current task for wakeup if the value is not yet available, and returning None if the stream is exhausted. Read more
Source§

unsafe fn poll_cancel(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()>

Attempt to cancel the stream, registering the current task for wakeup if it has not finished cancelling yet. Read more
Source§

fn size_hint(&self) -> (usize, Option<usize>)

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

impl<T: Debug> Debug for MustComplete<T>

Source§

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

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

impl<'__pin, T> Unpin for MustComplete<T>
where PinnedFieldsOf<__Origin<'__pin, T>>: Unpin,

Auto Trait Implementations§

§

impl<T> Freeze for MustComplete<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for MustComplete<T>
where T: RefUnwindSafe,

§

impl<T> Send for MustComplete<T>
where T: Send,

§

impl<T> Sync for MustComplete<T>
where T: Sync,

§

impl<T> UnwindSafe for MustComplete<T>
where T: 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> 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> CompletionFutureExt for T
where T: CompletionFuture + ?Sized,

Source§

unsafe fn poll(&mut self, cx: &mut Context<'_>) -> Poll<Self::Output>
where Self: Unpin,

A convenience for calling CompletionFuture::poll on Unpin futures. Read more
Source§

unsafe fn poll_cancel(&mut self, cx: &mut Context<'_>) -> Poll<()>
where Self: Unpin,

A convenience for calling CompletionFuture::poll_cancel on Unpin futures. Read more
Source§

fn must_complete(self) -> MustComplete<Self>
where Self: Sized,

Make sure that the future will complete. Any requests to cancel the future through poll_cancel will be ignored.
Source§

fn now_or_never(self) -> NowOrNever<Self>
where Self: Sized,

Get the future’s output if it’s ready, or cancel it if it’s not. Read more
Source§

fn catch_unwind(self) -> CatchUnwind<Self>
where Self: Sized + UnwindSafe,

Available on crate feature std only.
Catch panics in the future. Read more
Source§

fn boxed<'a>(self) -> BoxCompletionFuture<'a, Self::Output>
where Self: Sized + Send + 'a,

Available on crate feature alloc only.
Box the future, erasing its type. Read more
Source§

fn boxed_local<'a>(self) -> LocalBoxCompletionFuture<'a, Self::Output>
where Self: Sized + 'a,

Available on crate feature alloc only.
Box the future locally, erasing its type. Read more
Source§

impl<T> CompletionStreamExt for T
where T: CompletionStream + ?Sized,

Source§

unsafe fn poll_next(&mut self, cx: &mut Context<'_>) -> Poll<Option<Self::Item>>
where Self: Unpin,

A convenience for calling CompletionStream::poll_next on Unpin streams. Read more
Source§

unsafe fn poll_cancel(&mut self, cx: &mut Context<'_>) -> Poll<()>
where Self: Unpin,

A convenience for calling CompletionStream::poll_cancel on Unpin streams. Read more
Source§

fn must_complete(self) -> MustComplete<Self>
where Self: Sized,

Make sure that the stream will complete. Any requests to cancel the stream through poll_cancel will be ignored.
Source§

fn next(&mut self) -> Next<'_, Self>
where Self: Unpin,

Get the next item in the stream. Read more
Source§

fn count(self) -> Count<Self>
where Self: Sized,

Count the number of items in the stream. Read more
Source§

fn last(self) -> Last<Self>
where Self: Sized,

Get the last element in the stream. Read more
Source§

fn nth(&mut self, n: usize) -> Nth<'_, Self>
where Self: Unpin,

Get the nth element in the stream. Read more
Source§

fn step_by(self, step: usize) -> StepBy<Self>
where Self: Sized,

Create a stream starting at the same point, but stepping by the given amount each iteration. Read more
Source§

fn chain<U: CompletionStream<Item = Self::Item>>( self, other: U, ) -> Chain<Self, U>
where Self: Sized,

Chain this stream with another. Read more
Source§

fn map<T, F: FnMut(Self::Item) -> T>(self, f: F) -> Map<Self, F>
where Self: Sized,

Map this stream’s items with a closure. Read more
Source§

fn then<F: FnMut(Self::Item) -> Fut, Fut: CompletionFuture>( self, f: F, ) -> Then<Self, F, Fut>
where Self: Sized,

Map this stream’s items with an asynchronous closure. Read more
Source§

fn for_each<F: FnMut(Self::Item)>(self, f: F) -> ForEach<Self, F>
where Self: Sized,

Call a closure on each item the stream. Read more
Source§

fn filter<F>(self, f: F) -> Filter<Self, F>
where F: FnMut(&Self::Item) -> bool, Self: Sized,

Keep the values in the stream for which the predicate resolves to true. Read more
Source§

fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F>
where F: FnMut(Self::Item) -> Option<T>, Self: Sized,

Filter and map the items of the stream with a closure. Read more
Source§

fn enumerate(self) -> Enumerate<Self>
where Self: Sized,

Yield the current iteration count as well as the next value. Read more
Source§

fn peekable(self) -> Peekable<Self>
where Self: Sized,

Create a stream which can use peek to look at the next element of the stream without consuming it. Read more
Source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where P: FnMut(&Self::Item) -> bool, Self: Sized,

Skip items while the predicate returns true. Read more
Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where P: FnMut(&Self::Item) -> bool, Self: Sized,

Take items while the predicate returns true. Read more
Source§

fn skip(self, n: usize) -> Skip<Self>
where Self: Sized,

Skip the first n items in the stream. Read more
Source§

fn take(self, n: usize) -> Take<Self>
where Self: Sized,

Takes the first n items of the stream. All other items will be ignored. Read more
Source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where Self: Sized, U: CompletionStream, F: FnMut(Self::Item) -> U,

Map the stream, flattening nested structure. Read more
Source§

fn flatten(self) -> Flatten<Self>
where Self: Sized, Self::Item: CompletionStream,

Flatten nested structure in the stream. Read more
Source§

fn fuse(self) -> Fuse<Self>
where Self: Sized,

Fuse the stream so that it is guaranteed to continue to yield None when exhausted. Read more
Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where Self: Sized, F: FnMut(&Self::Item),

Do something with each element in the stream, passing the value on. Read more
Source§

fn collect<C: FromCompletionStream<Self::Item>>(self) -> Collect<Self, C>
where Self: Sized,

Collect all the items in the stream into a collection. Read more
Source§

fn fold<T, F>(self, init: T, f: F) -> Fold<Self, F, T>
where F: FnMut(T, Self::Item) -> T, Self: Sized,

Accumulate a value over a stream. Read more
Source§

fn all<F: FnMut(Self::Item) -> bool>(&mut self, f: F) -> All<'_, Self, F>
where Self: Unpin,

Check if all the elements in the stream match a predicate. Read more
Source§

fn any<F: FnMut(Self::Item) -> bool>(&mut self, f: F) -> Any<'_, Self, F>
where Self: Unpin,

Check if any of the elements in the stream match a predicate. Read more
Source§

fn find<P>(&mut self, predicate: P) -> Find<'_, Self, P>
where Self: Unpin, P: FnMut(&Self::Item) -> bool,

Search for an element in the stream that satisfies a predicate. Read more
Source§

fn find_map<B, F>(&mut self, f: F) -> FindMap<'_, Self, F>
where Self: Unpin, F: FnMut(Self::Item) -> Option<B>,

Finds the first element in a stream for which a function returns Some. Read more
Source§

fn position<P>(&mut self, predicate: P) -> Position<'_, Self, P>
where Self: Unpin, P: FnMut(Self::Item) -> bool,

Get the index of an element in the stream. Read more
Source§

fn max(self) -> Max<Self>
where Self: Sized, Self::Item: Ord,

Find the maximum value in the stream. Read more
Source§

fn max_by<F>(self, compare: F) -> MaxBy<Self, F>
where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Find the maximum value in the stream using the specified comparison function. Read more
Source§

fn max_by_key<B, F>(self, f: F) -> MaxByKey<Self, B, F>
where Self: Sized, B: Ord, F: FnMut(&Self::Item) -> B,

Find the element that gives the maximum value from the specified function. Read more
Source§

fn min(self) -> Min<Self>
where Self: Sized, Self::Item: Ord,

Find the minimum value in the stream. Read more
Source§

fn min_by<F>(self, compare: F) -> MinBy<Self, F>
where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Find the minimum value in the stream using the specified comparison function. Read more
Source§

fn min_by_key<B, F>(self, f: F) -> MinByKey<Self, B, F>
where Self: Sized, B: Ord, F: FnMut(&Self::Item) -> B,

Find the element that gives the minimum value from the specified function. Read more
Source§

fn copied<'a, T: Copy + 'a>(self) -> Copied<Self>
where Self: CompletionStream<Item = &'a T> + Sized,

Copy all of the elements in the stream. Read more
Source§

fn cloned<'a, T: Clone + 'a>(self) -> Cloned<Self>
where Self: CompletionStream<Item = &'a T> + Sized,

Clone all of the elements in the stream. Read more
Source§

fn cycle(self) -> Cycle<Self>
where Self: Sized + Clone,

Repeat the stream endlessly. Read more
Source§

fn boxed<'a>(self) -> BoxCompletionStream<'a, Self::Item>
where Self: Sized + Send + 'a,

Available on crate feature alloc only.
Box the stream, erasing its type. Read more
Source§

fn boxed_local<'a>(self) -> LocalBoxCompletionStream<'a, Self::Item>
where Self: Sized + 'a,

Available on crate feature alloc only.
Box the stream locally, erasing its type. 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> 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 = 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.