Trait PyMod

Source
pub trait PyMod<Rhs = Self> {
    type Output;

    // Required method
    fn pymod(&self, rhs: Rhs) -> Self::Output;
}
Expand description

The PyMod trait, inpired by pythons % operator, describes a method for finding the modulo between two numbers which, rather uniquely, preserves the sign of the denominator.

§Example

use rstmt_core::PyMod;

let m = 12;
assert_eq!(22.pymod(m), 10);
assert_eq!(-17.pymod(m), -5);

Required Associated Types§

Required Methods§

Source

fn pymod(&self, rhs: Rhs) -> Self::Output

Implementors§

Source§

impl<T> PyMod for T
where T: Copy + Num + PartialOrd + Signed,