Trait pdatastructs::Counter [] [src]

pub trait Counter: Copy + Debug + Ord + Sized {
    fn checked_add(self, other: Self) -> Option<Self>;
fn zero() -> Self;
fn one() -> Self;
fn is_zero(&self) -> bool; }

Abstract, but safe counter.

Required Methods

Add self to another counter.

Returns Some(Self) when the addition was successfull (i.e. no overflow occured) and None in case of an error.

Return a counter representing zero.

Return a counter representing one.

Checks whether the counter is zero.

Implementations on Foreign Types

impl Counter for usize
[src]

[src]

[src]

[src]

[src]

impl Counter for u64
[src]

[src]

[src]

[src]

[src]

impl Counter for u32
[src]

[src]

[src]

[src]

[src]

impl Counter for u16
[src]

[src]

[src]

[src]

[src]

impl Counter for u8
[src]

[src]

[src]

[src]

[src]

Implementors