[][src]Struct iterpipes::LazyMut

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

A "lazily" create pipe with a mutable 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 mutable state can not be reseted, reset will panic if it's called.

Example

use iterpipes::*;

let mut counter: u8 = 0;
let mut pipe = LazyMut::new(|i: u8| {
    counter += 1;
    i*counter
});

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

Implementations

impl<I, O, F> LazyMut<I, O, F> where
    F: FnMut(I) -> O, 
[src]

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

Create a new lazy pipe.

Trait Implementations

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

type InputItem = I

The type of input this pipe accepts.

type OutputItem = O

The type of output this pipe produces.

Auto Trait Implementations

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

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

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

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

impl<I, O, F> UnwindSafe for LazyMut<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.