Skip to main content

Repeat

Struct Repeat 

Source
pub struct Repeat<F>(/* private fields */);
Expand description

Applies a function to each input, yielding results indefinitely.

Never completes on its own - will continue processing until externally stopped.

Trait Implementations§

Source§

impl<I, O, F> Sans<I, O> for Repeat<F>
where F: FnMut(I) -> O,

Source§

type Return = I

Type of final result when computation completes
Source§

fn next(&mut self, input: I) -> Step<O, Self::Return>

Process input, returning Yield to continue or Return to complete.
Source§

fn and_then<T, F>(self, f: F) -> AndThen<Self, T::Next, F>
where Self: Sized + Sans<I, O, Return = I>, T: InitSans<I, O>, F: FnOnce(Self::Return) -> T,

Chain with a coroutine created from this coroutine’s return value. Read more
Source§

fn boxed(self) -> Box<dyn Sans<I, O, Return = Self::Return>>
where Self: Sized + 'static,

Source§

fn chain<R>(self, r: R) -> Chain<Self, R>
where Self: Sized + Sans<I, O, Return = I>, R: Sans<I, O>,

Chain with another coroutine.
Source§

fn chain_once<F>(self, f: F) -> Chain<Self, Once<F>>
where Self: Sized + Sans<I, O, Return = I>, F: FnOnce(Self::Return) -> O,

Chain with a function that executes once.
Source§

fn chain_repeat<F>(self, f: F) -> Chain<Self, Repeat<F>>
where Self: Sized + Sans<I, O, Return = I>, F: FnMut(Self::Return) -> O,

Chain with a function that repeats indefinitely.
Source§

fn map_input<I2, F>(self, f: F) -> MapInput<Self, F>
where Self: Sized, F: FnMut(I2) -> I,

Transform inputs before they reach this coroutine.
Source§

fn map_yield<O2, F>(self, f: F) -> MapYield<Self, F, I, O>
where Self: Sized, F: FnMut(O) -> O2,

Transform yielded values before returning them.
Source§

fn map_return<D2, F>(self, f: F) -> MapReturn<Self, F>
where Self: Sized, F: FnMut(Self::Return) -> D2,

Transform the final result when completing.
Source§

fn into_iter(self) -> SansIter<O, Self> ⓘ
where Self: Sized + Sans<(), O>,

Convert to an iterator.

Auto Trait Implementations§

§

impl<F> Freeze for Repeat<F>
where F: Freeze,

§

impl<F> RefUnwindSafe for Repeat<F>
where F: RefUnwindSafe,

§

impl<F> Send for Repeat<F>
where F: Send,

§

impl<F> Sync for Repeat<F>
where F: Sync,

§

impl<F> Unpin for Repeat<F>
where F: Unpin,

§

impl<F> UnsafeUnpin for Repeat<F>
where F: UnsafeUnpin,

§

impl<F> UnwindSafe for Repeat<F>
where 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<I, O, S> TrySans<I, O> for S
where S: Sans<I, O>,

Source§

fn ok_map<P, E, T, F>(self, f: F) -> OkMap<Self, T::Next, F>
where Self: Sans<I, O, Return = Result<P, E>>, T: InitSans<I, O>, T::Next: Sans<I, O>, F: FnOnce(P) -> T,

Maps Ok return values through a function that produces an InitSans.
Source§

fn ok_and_then<P, Q, E, T, F>(self, f: F) -> OkAndThen<Self, T::Next, F>
where Self: Sans<I, O, Return = Result<P, E>>, T: InitSans<I, O>, T::Next: Sans<I, O, Return = Result<Q, E>>, F: FnOnce(P) -> T,

Chains through a function that produces an InitSans with a Result return type.
Source§

fn ok_chain<E, R>(self, next: R) -> OkChain<Self, R>
where Self: Sans<I, O, Return = Result<I, E>>, R: Sans<I, O>,

Chains to another coroutine only if the first returns Ok.
Source§

fn flatten<T, E>(self) -> Flatten<Self>
where Self: Sans<I, O, Return = Result<Result<T, E>, E>>,

Flattens nested Result types in the return value.