Funnel

Struct Funnel 

Source
pub struct Funnel<C, T, F> { /* private fields */ }
Expand description

A RefCollector that maps a mutable reference to an item into another mutable reference.

This struct is created by RefCollector::funnel(). See its documentation for more.

Trait Implementations§

Source§

impl<C: Clone, T, F: Clone> Clone for Funnel<C, T, F>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T, C, F> Collector for Funnel<C, T, F>
where C: RefCollector, F: FnMut(&mut T) -> &mut C::Item,

Source§

type Item = T

Type of items this collector collects and accumulates.
Source§

type Output = <C as Collector>::Output

The result this collector yields, via the finish method. Read more
Source§

fn collect(&mut self, item: Self::Item) -> ControlFlow<()>

Collects an item and returns a ControlFlow indicating whether the collector has stopped accumulating right after this operation. Read more
Source§

fn finish(self) -> Self::Output

Consumes the collector and returns the accumulated result. Read more
Source§

fn break_hint(&self) -> bool

Returns a hint whether the collector has stopped accumulating. Read more
Source§

fn collect_many( &mut self, items: impl IntoIterator<Item = Self::Item>, ) -> ControlFlow<()>
where Self: Sized,

Collects items from an iterator and returns a ControlFlow indicating whether the collector has stopped collecting right after this operation. Read more
Source§

fn collect_then_finish( self, items: impl IntoIterator<Item = Self::Item>, ) -> Self::Output
where Self: Sized,

Collects items from an iterator, consumes the collector, and produces the accumulated result. Read more
Source§

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

Creates a Collector that can “safely” collect items even after the underlying collector has stopped accumulating, without triggering undesired behaviors. Read more
Source§

fn cloned(self) -> Cloning<Self>
where Self: Sized, Self::Item: Clone,

👎Deprecated since 0.3.0: Use cloning()
Source§

fn cloning(self) -> Cloning<Self>
where Self: Sized, Self::Item: Clone,

Creates a RefCollector that clones every collected item. Read more
Source§

fn copied(self) -> Copying<Self>
where Self: Sized, Self::Item: Copy,

👎Deprecated since 0.3.0: Use copying()
Source§

fn copying(self) -> Copying<Self>
where Self: Sized, Self::Item: Copy,

Creates a RefCollector that copies every collected item. Read more
Source§

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

Creates a Collector that calls a closure on each item before collecting. Read more
Source§

fn map_ref<F, T>(self, f: F) -> MapRef<Self, T, F>
where Self: Sized, F: FnMut(&mut T) -> Self::Item,

Creates a RefCollector that calls a closure on each item by mutable reference before collecting. Read more
Source§

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

Creates a Collector that uses a closure to determine whether an item should be accumulated. Read more
Source§

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

Creates a Collector that stops accumulating after collecting the first n items, or fewer if the underlying collector ends sooner. Read more
Source§

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

Creates a Collector that accumulates items as long as a predicate returns true. Read more
Source§

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

Creates a Collector that skips the first n collected items before it begins accumulating them. Read more
Source§

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

Creates a Collector that feeds every item in the first collector until it stops accumulating, then continues feeding items into the second one. Read more
Source§

fn partition<C, F>( self, pred: F, other_if_false: C, ) -> Partition<Self, C::IntoCollector, F>
where Self: Sized, C: IntoCollector<Item = Self::Item>, F: FnMut(&mut Self::Item) -> bool,

Creates a Collector that distributes items between two collectors based on a predicate. Read more
Source§

fn unzip<C>(self, other: C) -> Unzip<Self, C::IntoCollector>
where Self: Sized, C: IntoCollector,

Creates a Collector that destructures each 2-tuple (A, B) item and distributes its fields: A goes to the first collector, and B goes to the second collector. Read more
Source§

fn unbatching<T, F>(self, f: F) -> Unbatching<Self, T, F>
where Self: Sized, F: FnMut(&mut Self, T) -> ControlFlow<()>,

Creates a Collector with a custom collection logic. Read more
Source§

fn unbatching_ref<T, F>(self, f: F) -> UnbatchingRef<Self, T, F>
where Self: Sized, F: FnMut(&mut Self, &mut T) -> ControlFlow<()>,

Creates a RefCollector with a custom collection logic. Read more
Source§

fn map_output<T, F>(self, f: F) -> MapOutput<Self, T, F>
where Self: Sized, F: FnOnce(Self::Output) -> T,

Creates a Collector that transforms the final accumulated result. Read more
Source§

fn nest<C>(self, inner: C) -> Nest<Self, C::IntoCollector>
where Self: Collector<Item = C::Output> + Sized, C: IntoCollector<IntoCollector: Clone>,

Available on crate feature unstable only.
Creates a Collector that collects all outputs produced by an inner collector. Read more
Source§

fn nest_exact<C>(self, inner: C) -> NestExact<Self, C::IntoCollector>
where Self: Collector<Item = C::Output> + Sized, C: IntoCollector<IntoCollector: Clone>,

Available on crate feature unstable only.
Creates a Collector that collects all outputs produced by an inner collector. Read more
Source§

impl<C: Debug, T, F> Debug for Funnel<C, T, F>

Source§

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

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

impl<T, C, F> RefCollector for Funnel<C, T, F>
where C: RefCollector, F: FnMut(&mut T) -> &mut C::Item,

Source§

fn collect_ref(&mut self, item: &mut T) -> ControlFlow<()>

Collects an item and returns a ControlFlow indicating whether the collector has stopped accumulating right after this operation. Read more
Source§

fn then<C>(self, other: C) -> Combine<Self, C::IntoCollector>
where Self: Sized, C: IntoCollector<Item = Self::Item>,

👎Deprecated since 0.3.0: Use combine()
Source§

fn combine<C>(self, other: C) -> Combine<Self, C::IntoCollector>
where Self: Sized, C: IntoCollector<Item = Self::Item>,

The most important adaptor. The reason why this crate exists. Read more
Source§

fn funnel<F, T>(self, func: F) -> Funnel<Self, T, F>
where Self: Sized, F: FnMut(&mut T) -> &mut Self::Item,

Creates a RefCollector that maps a mutable reference to an item into another mutable reference. Read more

Auto Trait Implementations§

§

impl<C, T, F> Freeze for Funnel<C, T, F>
where C: Freeze, F: Freeze,

§

impl<C, T, F> RefUnwindSafe for Funnel<C, T, F>

§

impl<C, T, F> Send for Funnel<C, T, F>
where C: Send, F: Send,

§

impl<C, T, F> Sync for Funnel<C, T, F>
where C: Sync, F: Sync,

§

impl<C, T, F> Unpin for Funnel<C, T, F>
where C: Unpin, F: Unpin,

§

impl<C, T, F> UnwindSafe for Funnel<C, T, F>
where C: UnwindSafe, 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> 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> CollectorByMut for T
where &'a mut T: for<'a> IntoCollector,

Source§

type CollectorMut<'a> = <&'a mut T as IntoCollector>::IntoCollector where T: 'a

Which collector being produced?
Source§

fn collector_mut(&mut self) -> <T as CollectorByMut>::CollectorMut<'_>

Creates a Collector from a mutable reference of a value.
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<C> IntoCollector for C
where C: Collector,

Source§

type Item = <C as Collector>::Item

The type of the items being collected.
Source§

type Output = <C as Collector>::Output

The output of the collector.
Source§

type IntoCollector = C

Which collector being produced?
Source§

fn into_collector(self) -> <C as IntoCollector>::IntoCollector

Creates a collector from a value.
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.