Counter

Trait Counter 

Source
pub trait Counter: 'static {
    type Primitive: Num;

    const ZERO: Self;

    // Required methods
    fn add_assign(&self, n: Self::Primitive);
    fn sub_assign(&self, n: Self::Primitive);
    fn fetch(&self) -> Self::Primitive;
}
Expand description

A type suitable as a shared census counter.

Required Associated Constants§

Source

const ZERO: Self

A fresh instance of this counter holding the value of 0.

Required Associated Types§

Source

type Primitive: Num

The primitive type underlying this counter.

Required Methods§

Source

fn add_assign(&self, n: Self::Primitive)

Eventually increase the value of this counter by n.

Source

fn sub_assign(&self, n: Self::Primitive)

Eventually decrease the value of this counter by n.

Source

fn fetch(&self) -> Self::Primitive

Eventually retrieve the value of this counter.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§