pub struct OffsetNumC<N: FromPrimitive, const M: usize, const O: isize> { /* private fields */ }

Implementations§

source§

impl<N: NumType, const M: usize, const O: isize> OffsetNumC<N, M, O>

source

pub fn new(num: N) -> Self

source

pub fn iter(&self) -> ModNumIterator<N, Self>

Returns an iterator starting at a (mod m) and ending at a - 1 (mod m)

source

pub fn min_max(&self) -> (N, N)

Returns the minimum and maximum possible values.

Trait Implementations§

source§

impl<N: NumType, const M: usize, const O: isize> Add<N> for OffsetNumC<N, M, O>

§

type Output = OffsetNumC<N, M, O>

The resulting type after applying the + operator.
source§

fn add(self, rhs: N) -> Self::Output

Performs the + operation. Read more
source§

impl<N: NumType, const M: usize, const O: isize> Add<OffsetNumC<N, M, O>> for OffsetNumC<N, M, O>

§

type Output = OffsetNumC<N, M, O>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
source§

impl<N: NumType, const M: usize, const O: isize> AddAssign<N> for OffsetNumC<N, M, O>

source§

fn add_assign(&mut self, rhs: N)

Performs the += operation. Read more
source§

impl<N: NumType, const M: usize, const O: isize> AddAssign<OffsetNumC<N, M, O>> for OffsetNumC<N, M, O>

source§

fn add_assign(&mut self, rhs: OffsetNumC<N, M, O>)

Performs the += operation. Read more
source§

impl<N: Clone + FromPrimitive, const M: usize, const O: isize> Clone for OffsetNumC<N, M, O>

source§

fn clone(&self) -> OffsetNumC<N, M, O>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<N: Debug + FromPrimitive, const M: usize, const O: isize> Debug for OffsetNumC<N, M, O>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<N: Default + FromPrimitive, const M: usize, const O: isize> Default for OffsetNumC<N, M, O>

source§

fn default() -> OffsetNumC<N, M, O>

Returns the “default value” for a type. Read more
source§

impl<N: Hash + FromPrimitive, const M: usize, const O: isize> Hash for OffsetNumC<N, M, O>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<N: NumType, const M: usize, const O: isize> MNum for OffsetNumC<N, M, O>

§

type Num = N

source§

fn a(&self) -> Self::Num

source§

fn m(&self) -> Self::Num

source§

fn with(&self, new_a: Self::Num) -> Self

source§

fn replace(&mut self, new_a: Self::Num)

source§

impl<N: NumType, const M: usize, const O: isize> Neg for OffsetNumC<N, M, O>

§

type Output = OffsetNumC<N, M, O>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl<N: Ord + FromPrimitive, const M: usize, const O: isize> Ord for OffsetNumC<N, M, O>

source§

fn cmp(&self, other: &OffsetNumC<N, M, O>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl<N: NumType, const M: usize, const O: isize> PartialEq<N> for OffsetNumC<N, M, O>

Returns true if other is congruent to self.a() (mod self.m())

source§

fn eq(&self, other: &N) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<N: PartialEq + FromPrimitive, const M: usize, const O: isize> PartialEq<OffsetNumC<N, M, O>> for OffsetNumC<N, M, O>

source§

fn eq(&self, other: &OffsetNumC<N, M, O>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<N: NumType, const M: usize, const O: isize> PartialOrd<N> for OffsetNumC<N, M, O>

source§

fn partial_cmp(&self, other: &N) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<N: PartialOrd + FromPrimitive, const M: usize, const O: isize> PartialOrd<OffsetNumC<N, M, O>> for OffsetNumC<N, M, O>

source§

fn partial_cmp(&self, other: &OffsetNumC<N, M, O>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<N: NumType, const M: usize, const O: isize> Sub<N> for OffsetNumC<N, M, O>

§

type Output = OffsetNumC<N, M, O>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: N) -> Self::Output

Performs the - operation. Read more
source§

impl<N: NumType, const M: usize, const O: isize> Sub<OffsetNumC<N, M, O>> for OffsetNumC<N, M, O>

§

type Output = OffsetNumC<N, M, O>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
source§

impl<N: NumType, const M: usize, const O: isize> SubAssign<N> for OffsetNumC<N, M, O>

source§

fn sub_assign(&mut self, rhs: N)

Performs the -= operation. Read more
source§

impl<N: NumType, const M: usize, const O: isize> SubAssign<OffsetNumC<N, M, O>> for OffsetNumC<N, M, O>

source§

fn sub_assign(&mut self, rhs: OffsetNumC<N, M, O>)

Performs the -= operation. Read more
source§

impl<N: Copy + FromPrimitive, const M: usize, const O: isize> Copy for OffsetNumC<N, M, O>

source§

impl<N: Eq + FromPrimitive, const M: usize, const O: isize> Eq for OffsetNumC<N, M, O>

source§

impl<N: FromPrimitive, const M: usize, const O: isize> StructuralEq for OffsetNumC<N, M, O>

source§

impl<N: FromPrimitive, const M: usize, const O: isize> StructuralPartialEq for OffsetNumC<N, M, O>

Auto Trait Implementations§

§

impl<N, const M: usize, const O: isize> RefUnwindSafe for OffsetNumC<N, M, O>where N: RefUnwindSafe,

§

impl<N, const M: usize, const O: isize> Send for OffsetNumC<N, M, O>where N: Send,

§

impl<N, const M: usize, const O: isize> Sync for OffsetNumC<N, M, O>where N: Sync,

§

impl<N, const M: usize, const O: isize> Unpin for OffsetNumC<N, M, O>where N: Unpin,

§

impl<N, const M: usize, const O: isize> UnwindSafe for OffsetNumC<N, M, O>where N: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.