Skip to main content

Once

Struct Once 

Source
pub struct Once<Item> { /* private fields */ }
Expand description

A pull that yields a single item.

Trait Implementations§

Source§

impl<Item: Clone> Clone for Once<Item>

Source§

fn clone(&self) -> Once<Item>

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<Item: Debug> Debug for Once<Item>

Source§

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

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

impl<Item: Default> Default for Once<Item>

Source§

fn default() -> Once<Item>

Returns the “default value” for a type. Read more
Source§

impl<Item> Pull for Once<Item>

Source§

type Ctx<'ctx> = ()

The context type required to poll this pull.
Source§

type Item = Item

The type of items yielded by this pull.
Source§

type Meta = ()

The metadata type associated with each item.
Source§

type CanPend = Infallible

Whether this pull can return PullStep::Pending.
Source§

type CanEnd = Yes

Whether this pull can return PullStep::Ended.
Source§

fn pull( self: Pin<&mut Self>, _ctx: &mut Self::Ctx<'_>, ) -> PullStep<Self::Item, Self::Meta, Self::CanPend, Self::CanEnd>

Attempts to pull the next item from this stream.
Source§

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

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

fn fuse( self, ) -> impl for<'ctx> FusedPull<Ctx<'ctx> = Self::Ctx<'ctx>, Item = Self::Item, Meta = Self::Meta, CanPend = Self::CanPend, CanEnd = Self::CanEnd>
where Self: Sized,

Creates a pull that ends after the first None. Read more
Source§

fn by_ref(&mut self) -> &mut Self

Borrows this pull, allowing it to be used by reference.
Source§

fn chain<U>(self, other: U) -> Chain<Self, U>
where Self: Sized + FusedPull<CanEnd = Yes>, U: Pull<Item = Self::Item, Meta = Self::Meta>,

Takes two pulls and creates a new pull over both in sequence. Read more
Source§

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

Creates a pull which gives the current iteration count as well as the next value. Read more
Source§

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

Creates a pull which uses a closure to determine if an element should be yielded. Read more
Source§

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

Creates a pull that both filters and maps. Read more
Source§

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

Creates a pull that works like map, but flattens nested structure. Read more
Source§

fn flatten( self, ) -> Flatten<Self, <Self::Item as IntoIterator>::IntoIter, Self::Meta>
where Self: Sized, Self::Item: IntoIterator,

Creates a pull that flattens nested structure. Read more
Source§

fn flatten_stream(self) -> FlattenStream<Self, Self::Item, Self::Meta>
where Self: Sized, Self::Item: Stream,

Creates a pull that flattens items that are streams by polling each inner stream. Read more
Source§

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

Creates a future which runs the given function on each element of a pull.
Source§

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

Creates a future which collects all elements of a pull into a collection. Read more
Source§

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

Does something with each element of a pull, passing the value on. Read more
Source§

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

Takes a closure and creates a pull that calls that closure on each element. Read more
Source§

fn send_sink<Push>(self, push: Push) -> SendSink<Self, Push>
where Self: Sized, Push: Sink<Self::Item>,

Creates a future that pulls all items and sends them into a crate::Sink.
Source§

fn send_push<Psh>(self, push: Psh) -> SendPush<Self, Psh>
where Self: Sized, Psh: Push<Self::Item, Self::Meta>,

Creates a future that pulls all items and pushes them into a crate::push::Push.
Source§

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

Creates a pull that skips the first n elements.
Source§

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

Creates a pull that skips elements based on a predicate. Read more
Source§

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

Creates a pull that yields the first n elements, or fewer if the underlying pull ends sooner.
Source§

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

Creates a pull that yields elements based on a predicate. Read more
Source§

fn zip<U>(self, other: U) -> Zip<Self, U>
where Self: Sized, U: Pull<Meta = Self::Meta>,

Zips two pulls together, stopping once either is exhausted.
Source§

fn zip_longest<U>(self, other: U) -> ZipLongest<Self, U>
where Self: Sized + FusedPull, U: FusedPull<Meta = Self::Meta>,

Zips two pulls together, continuing until both are exhausted. Read more
Source§

fn next(self) -> Next<Self>
where Self: Sized,

Creates a future that resolves with the next item from this pull. Read more
Source§

fn cross_singleton<SinglePull>( self, singleton_pull: SinglePull, ) -> CrossSingleton<Self, SinglePull, Option<SinglePull::Item>>
where Self: Sized, SinglePull: Pull, SinglePull::Item: Clone,

Crosses each item from this pull with a singleton value from another pull. Read more
Source§

fn cross_singleton_state<SinglePull>( self, singleton_pull: SinglePull, singleton_state: &mut Option<SinglePull::Item>, ) -> CrossSingleton<Self, SinglePull, &mut Option<SinglePull::Item>>
where Self: Sized, SinglePull: Pull, SinglePull::Item: Clone,

Self::cross_singleton with external state.
Source§

fn symmetric_hash_join<Key, V1, Rhs, V2, LhsState, RhsState>( self, rhs: Rhs, lhs_state: LhsState, rhs_state: RhsState, ) -> SymmetricHashJoin<Self, Rhs, LhsState, RhsState, LhsState, RhsState>
where Self: Sized + FusedPull<Item = (Key, V1), Meta = ()>, Key: Eq + Hash + Clone, V1: Clone, V2: Clone, Rhs: FusedPull<Item = (Key, V2), Meta = ()>, LhsState: HalfJoinState<Key, V1, V2>, RhsState: HalfJoinState<Key, V2, V1>,

Available on crate feature std only.
Performs a symmetric hash join with another pull. Read more
Source§

fn symmetric_hash_join_state<'a, Key, V1, Rhs, V2, LhsState, RhsState>( self, rhs: Rhs, lhs_state: &'a mut LhsState, rhs_state: &'a mut RhsState, ) -> SymmetricHashJoin<Self, Rhs, &'a mut LhsState, &'a mut RhsState, LhsState, RhsState>
where Self: Sized + FusedPull<Item = (Key, V1), Meta = ()>, Key: Eq + Hash + Clone, V1: Clone, V2: Clone, Rhs: FusedPull<Item = (Key, V2), Meta = ()>, LhsState: HalfJoinState<Key, V1, V2>, RhsState: HalfJoinState<Key, V2, V1>,

Available on crate feature std only.
Self::symmetric_hash_join with external state.
Source§

impl<Item> FusedPull for Once<Item>

Source§

impl<Item> Unpin for Once<Item>

Auto Trait Implementations§

§

impl<Item> Freeze for Once<Item>
where Item: Freeze,

§

impl<Item> RefUnwindSafe for Once<Item>
where Item: RefUnwindSafe,

§

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

§

impl<Item> Sync for Once<Item>
where Item: Sync,

§

impl<Item> UnsafeUnpin for Once<Item>
where Item: UnsafeUnpin,

§

impl<Item> UnwindSafe for Once<Item>
where Item: 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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.