[][src]Struct iterpipes::Counter

pub struct Counter<T> where
    T: AddAssign<T> + Copy
{ /* fields omitted */ }

A continous counter.

This pipe has an counter and a delta value. Every time next is called, the current counter value is returned and the delta is added to the counter. It also knows it's starting value and can therefore be reseted.

Example

use iterpipes::*;

let mut counter: Counter<u8> = Counter::new(1, 2);
assert_eq!(1, counter.next(()));
assert_eq!(3, counter.next(()));

Implementations

impl<T> Counter<T> where
    T: AddAssign<T> + Copy
[src]

pub fn new(starting_value: T, delta: T) -> Self[src]

Trait Implementations

impl<T> Pipe for Counter<T> where
    T: AddAssign<T> + Copy
[src]

type InputItem = ()

The type of input this pipe accepts.

type OutputItem = T

The type of output this pipe produces.

Auto Trait Implementations

impl<T> RefUnwindSafe for Counter<T> where
    T: RefUnwindSafe

impl<T> Send for Counter<T> where
    T: Send

impl<T> Sync for Counter<T> where
    T: Sync

impl<T> Unpin for Counter<T> where
    T: Unpin

impl<T> UnwindSafe for Counter<T> where
    T: 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.