[][src]Struct iterpipes::Lazy

pub struct Lazy<I, O, F> where
    F: Fn(I) -> O, 
{ /* fields omitted */ }

A "lazily" create pipe with an immutable state.

This pipe's behavior is defined by a callable object, for example a lambda expression, and can therefore be "lazily" created inline.

Since callable objects with an immutable state don't need to be reseted, reset is a no-op.

Example

use iterpipes::*;

let mut counter: u8 = 2;
let mut pipe = Lazy::new(|i: u8| {
    i*counter
});

assert_eq!(2, pipe.next(1));
assert_eq!(4, pipe.next(2));

Implementations

impl<I, O, F> Lazy<I, O, F> where
    F: Fn(I) -> O, 
[src]

pub fn new(function: F) -> Self[src]

Create a new lazy pipe.

Trait Implementations

impl<I, O, F> Pipe for Lazy<I, O, F> where
    F: Fn(I) -> O, 
[src]

type InputItem = I

The type of input this pipe accepts.

type OutputItem = O

The type of output this pipe produces.

impl<I, O, F> ResetablePipe for Lazy<I, O, F> where
    F: Fn(I) -> O, 
[src]

Auto Trait Implementations

impl<I, O, F> RefUnwindSafe for Lazy<I, O, F> where
    F: RefUnwindSafe,
    I: RefUnwindSafe,
    O: RefUnwindSafe

impl<I, O, F> Send for Lazy<I, O, F> where
    F: Send,
    I: Send,
    O: Send

impl<I, O, F> Sync for Lazy<I, O, F> where
    F: Sync,
    I: Sync,
    O: Sync

impl<I, O, F> Unpin for Lazy<I, O, F> where
    F: Unpin,
    I: Unpin,
    O: Unpin

impl<I, O, F> UnwindSafe for Lazy<I, O, F> where
    F: UnwindSafe,
    I: UnwindSafe,
    O: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.