pub struct LazyMut<I, O, F>where
F: FnMut(I) -> O,{ /* private fields */ }
Expand description
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§
Trait Implementations§
Source§impl<I, O, F> Pipe for LazyMut<I, O, F>where
F: FnMut(I) -> O,
impl<I, O, F> Pipe for LazyMut<I, O, F>where
F: FnMut(I) -> O,
Source§type OutputItem = O
type OutputItem = O
The type of output this pipe produces.
Source§fn connect<O: Pipe<InputItem = Self::OutputItem>>(
self,
other: O,
) -> Connector<Self, O>where
Self: Sized,
fn connect<O: Pipe<InputItem = Self::OutputItem>>(
self,
other: O,
) -> Connector<Self, O>where
Self: Sized,
Connect two pipes. Read more
Auto Trait Implementations§
impl<I, O, F> Freeze for LazyMut<I, O, F>where
F: Freeze,
impl<I, O, F> RefUnwindSafe for LazyMut<I, O, F>
impl<I, O, F> Send for LazyMut<I, O, F>
impl<I, O, F> Sync for LazyMut<I, O, F>
impl<I, O, F> Unpin for LazyMut<I, O, F>
impl<I, O, F> UnwindSafe for LazyMut<I, O, F>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more