NonZeroFactorizable

Trait NonZeroFactorizable 

Source
pub trait NonZeroFactorizable: NonZero + Clone {
    type Factor: NonZero + Eq + PartialEq + Ord + PartialOrd + Hash + Clone + Debug;
    type Power: Add<Output = Self::Power> + AddAssign + Sub<Output = Self::Power> + SubAssign + One + Signed + Eq + Copy + Clone + Debug;

    // Required method
    fn factorize(&self) -> NonZeroFactorization<Self::Factor, Self::Power>;
}
Expand description

Creating a factorization of an integer or rational number.

This factorization does not necessarily consist of primes, as this can be computationally expensive.

Required Associated Types§

Source

type Factor: NonZero + Eq + PartialEq + Ord + PartialOrd + Hash + Clone + Debug

Some number greater than 1, probably a prime but not necessarily.

Source

type Power: Add<Output = Self::Power> + AddAssign + Sub<Output = Self::Power> + SubAssign + One + Signed + Eq + Copy + Clone + Debug

How often the factor appears in the number.

This is marked Copy, because a 64-bit power already allows for values up to 2^(2^64), which has about 5.6 * 10^18 decimal digits. Finding primes that are larger than that is too expensive.

Required Methods§

Source

fn factorize(&self) -> NonZeroFactorization<Self::Factor, Self::Power>

Decompose into factors.

Note that these factors will often be, but are not guaranteed to be, primes.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl NonZeroFactorizable for i8

Source§

impl NonZeroFactorizable for i16

Source§

impl NonZeroFactorizable for i32

Source§

impl NonZeroFactorizable for i64

Source§

impl NonZeroFactorizable for u8

Source§

impl NonZeroFactorizable for u16

Source§

impl NonZeroFactorizable for u32

Source§

impl NonZeroFactorizable for u64

Source§

impl NonZeroFactorizable for NonZeroI8

Source§

impl NonZeroFactorizable for NonZeroI16

Source§

impl NonZeroFactorizable for NonZeroI32

Source§

impl NonZeroFactorizable for NonZeroI64

Source§

impl NonZeroFactorizable for NonZeroU8

Source§

impl NonZeroFactorizable for NonZeroU16

Source§

impl NonZeroFactorizable for NonZeroU32

Source§

impl NonZeroFactorizable for NonZeroU64

Implementors§