Skip to main content

FlatMap

Struct FlatMap 

Source
pub struct FlatMap<Prev, Func, Iter, Meta> { /* private fields */ }
Expand description

Pull combinator that maps each item to an iterator and flattens the results.

Trait Implementations§

Source§

impl<Prev: Clone, Func: Clone, Iter: Clone, Meta: Clone> Clone for FlatMap<Prev, Func, Iter, Meta>

Source§

fn clone(&self) -> FlatMap<Prev, Func, Iter, Meta>

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<Prev: Debug, Func: Debug, Iter: Debug, Meta: Debug> Debug for FlatMap<Prev, Func, Iter, Meta>

Source§

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

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

impl<Prev, Func, IntoIter> Pull for FlatMap<Prev, Func, IntoIter::IntoIter, Prev::Meta>
where Prev: Pull, Func: FnMut(Prev::Item) -> IntoIter, IntoIter: IntoIterator,

Source§

type Ctx<'ctx> = <Prev as Pull>::Ctx<'ctx>

The context type required to poll this pull.
Source§

type Item = <IntoIter as IntoIterator>::Item

The type of items yielded by this pull.
Source§

type Meta = <Prev as Pull>::Meta

The metadata type associated with each item.
Source§

type CanPend = <Prev as Pull>::CanPend

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

type CanEnd = <Prev as Pull>::CanEnd

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 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 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 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<Prev, Func, IntoIter> FusedPull for FlatMap<Prev, Func, IntoIter::IntoIter, Prev::Meta>
where Prev: FusedPull, Func: FnMut(Prev::Item) -> IntoIter, IntoIter: IntoIterator,

Source§

impl<'__pin, Prev, Func, Iter, Meta> Unpin for FlatMap<Prev, Func, Iter, Meta>
where PinnedFieldsOf<__Origin<'__pin, Prev, Func, Iter, Meta>>: Unpin,

Auto Trait Implementations§

§

impl<Prev, Func, Iter, Meta> Freeze for FlatMap<Prev, Func, Iter, Meta>
where Prev: Freeze, Func: Freeze, Iter: Freeze, Meta: Freeze,

§

impl<Prev, Func, Iter, Meta> RefUnwindSafe for FlatMap<Prev, Func, Iter, Meta>
where Prev: RefUnwindSafe, Func: RefUnwindSafe, Iter: RefUnwindSafe, Meta: RefUnwindSafe,

§

impl<Prev, Func, Iter, Meta> Send for FlatMap<Prev, Func, Iter, Meta>
where Prev: Send, Func: Send, Iter: Send, Meta: Send,

§

impl<Prev, Func, Iter, Meta> Sync for FlatMap<Prev, Func, Iter, Meta>
where Prev: Sync, Func: Sync, Iter: Sync, Meta: Sync,

§

impl<Prev, Func, Iter, Meta> UnsafeUnpin for FlatMap<Prev, Func, Iter, Meta>
where Prev: UnsafeUnpin, Func: UnsafeUnpin, Iter: UnsafeUnpin, Meta: UnsafeUnpin,

§

impl<Prev, Func, Iter, Meta> UnwindSafe for FlatMap<Prev, Func, Iter, Meta>
where Prev: UnwindSafe, Func: UnwindSafe, Iter: UnwindSafe, Meta: 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.