Trait modicum::Modulus

source ·
pub trait Modulus<T>: Integer + Unsigned
where T: TryFrom<Self>, <T as TryFrom<Self>>::Error: Debug,
{ // Provided method fn cast(self) -> T { ... } }
Expand description

Modulus is an unsigned integer that can be cast to some other type T. The purpose is to restrict the modulus to unsigned integers yet allow calculations with signed integers when necessary.

Provided Methods§

source

fn cast(self) -> T

Cast the modulus to some other type T. Panics if the modulus cannot be converted to T.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T, M> Modulus<T> for M
where T: TryFrom<M>, <T as TryFrom<M>>::Error: Debug, M: Integer + Unsigned,