Skip to main content

FactorizationResidual

Trait FactorizationResidual 

Source
pub trait FactorizationResidual:
    Eq
    + Clone
    + Debug {
    // Required methods
    fn one() -> Self;
    fn is_one(&self) -> bool;
}
Expand description

The part of a value that a factorization did not decompose.

A residual of one means that nothing was left over, so the factors describe the value exactly.

This trait is deliberately weaker than num_traits::One: it demands no multiplication, because the residual of a rational factorization is a (numerator, denominator) pair, which has no meaningful product.

Required Methods§

Source

fn one() -> Self

The residual of a factorization that decomposed the entire value.

Source

fn is_one(&self) -> bool

Whether nothing was left undecomposed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FactorizationResidual for u8

Source§

fn one() -> Self

Source§

fn is_one(&self) -> bool

Source§

impl FactorizationResidual for u16

Source§

fn one() -> Self

Source§

fn is_one(&self) -> bool

Source§

impl FactorizationResidual for u32

Source§

fn one() -> Self

Source§

fn is_one(&self) -> bool

Source§

impl FactorizationResidual for u64

Source§

fn one() -> Self

Source§

fn is_one(&self) -> bool

Source§

impl FactorizationResidual for u128

Source§

fn one() -> Self

Source§

fn is_one(&self) -> bool

Source§

impl FactorizationResidual for usize

Source§

fn one() -> Self

Source§

fn is_one(&self) -> bool

Source§

impl<Numerator, Denominator> FactorizationResidual for (Numerator, Denominator)
where Numerator: FactorizationResidual, Denominator: FactorizationResidual,

A rational number leaves a residual on both sides of the fraction.

The two halves are (numerator residual, denominator residual); they can’t be merged into a single value, as that value would generally not be an integer.

Source§

fn one() -> Self

Source§

fn is_one(&self) -> bool

Implementors§

Source§

impl<const S: usize> FactorizationResidual for Ubig<S>

A big integer that was not decomposed entirely leaves a big integer behind.