pub trait Quantum: Copy + Clone + From<u32> + PartialEq + Eq + PartialOrd + Ord + Debug {
    type Absolute;

    // Required methods
    fn inner(&self) -> u32;
    fn dimension(topo: &Topology) -> &Dimension;
    fn normalized(self, topo: &Topology) -> Self;

    // Provided methods
    fn max_value(topo: &Topology) -> Self { ... }
    fn exp_wrapping(&self, topo: &Topology, pow: u8) -> u32 { ... }
    fn wrapping_add(self, other: u32) -> Self { ... }
    fn wrapping_sub(self, other: u32) -> Self { ... }
}
Expand description

A quantum in the physical sense: the smallest possible amount of something. Here, we are talking about Time and Space quanta.

Required Associated Types§

type Absolute

The absolute coordinate which this quantum corresponds to (time or space)

Required Methods§

fn inner(&self) -> u32

The u32 representation

fn dimension(topo: &Topology) -> &Dimension

Return the proper dimension (time or space) from the topology

fn normalized(self, topo: &Topology) -> Self

If this coord is beyond the max value for its dimension, wrap it around the max value

Provided Methods§

fn max_value(topo: &Topology) -> Self

The maximum quantum for this dimension

fn exp_wrapping(&self, topo: &Topology, pow: u8) -> u32

Convert to the absolute u32 coordinate space, wrapping if needed

fn wrapping_add(self, other: u32) -> Self

Exposes wrapping addition for the u32

fn wrapping_sub(self, other: u32) -> Self

Exposes wrapping subtraction for the u32

Object Safety§

This trait is not object safe.

Implementors§