Struct Once

Source
pub struct Once<E>(/* private fields */);
Expand description

Event iterator that yields a single event

This event iterator is created by the once() function. See its documentation for more.

Trait Implementations§

Source§

impl<E> Debug for Once<E>
where E: Debug,

Source§

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

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

impl<E> EventIterator for Once<E>

Source§

type Event<'me> = E where Self: 'me

The type of the events being iterated over
Source§

fn poll_next<'a>( self: Pin<&'a Self>, _cx: &mut Context<'_>, ) -> Poll<Option<Self::Event<'a>>>

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

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

Return the bounds on the remaining length of the event iterator. Read more
Source§

fn next<'a>(self: Pin<&'a Self>) -> Next<'a, Self>
where Self: Sized,

Create a future that resolves to the next event in the event iterator. Read more
Source§

fn next_unpinned(&self) -> Next<'_, Self>
where Self: Sized + Unpin,

Create a future that resolves to the next event in the event iterator. Read more
Source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where Self: Sized, F: for<'me> FnMut(Self::Event<'me>) -> B,

Take a closure and create an event iterator which calls that closure on each event. Read more
Source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where Self: Sized, P: for<'me> FnMut(&Self::Event<'me>) -> bool,

Create an event iterator which uses a closure to determine if an event should be yielded. Read more
Source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where Self: Sized, F: for<'me> FnMut(Self::Event<'me>) -> Option<B>,

Create an event iterator that both filters and maps. Read more
Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where Self: Sized, F: for<'me> FnMut(&Self::Event<'me>),

Do something with each event of an event iterator, passing the value on. Read more
Source§

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

Create an event iterator which gives the current iteration count as well as the next event. Read more
Source§

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

Create an event iterator which ends after the first Ready(None). Read more
Source§

fn tear(self) -> Tear<Self>
where Self: Sized,

Create an event iterator which ends after the first Ready(None). Read more
Source§

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

Create an event iterator that yields the first n events, or fewer if the underlying event iterator ends sooner. Read more
Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where Self: Sized, P: for<'me> FnMut(&Self::Event<'me>) -> bool,

Create an event iterator that yields elements based on a predicate. Read more

Auto Trait Implementations§

§

impl<E> !Freeze for Once<E>

§

impl<E> !RefUnwindSafe for Once<E>

§

impl<E> Send for Once<E>
where E: Send,

§

impl<E> !Sync for Once<E>

§

impl<E> Unpin for Once<E>
where E: Unpin,

§

impl<E> UnwindSafe for Once<E>
where E: 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<'b, T> AsEventIterator<'b> for T
where T: EventIterator + Unpin + 'b,

Source§

type Event = <T as EventIterator>::Event<'b>

The type of the events being iterated over
Source§

fn as_event_iter(&'b self) -> AsEventIter<'b, <T as AsEventIterator<'b>>::Event>

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.