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
fn checked_add(self, other: Self) -> Option<Self>
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.
fn zero() -> Self
Return a counter representing zero.
fn one() -> Self
Return a counter representing one.
fn is_zero(&self) -> bool
Checks whether the counter is zero.