Trait ExactRoots

Source
pub trait ExactRoots:
    Roots
    + Pow<u32, Output = Self>
    + Clone {
    // Provided methods
    fn nth_root_exact(&self, n: u32) -> Option<Self> { ... }
    fn sqrt_exact(&self) -> Option<Self> { ... }
    fn cbrt_exact(&self) -> Option<Self> { ... }
    fn is_nth_power(&self, n: u32) -> bool { ... }
    fn is_square(&self) -> bool { ... }
    fn is_cubic(&self) -> bool { ... }
}
Expand description

Extension on num_integer::Roots to support perfect power check on integers

Provided Methods§

Source

fn nth_root_exact(&self, n: u32) -> Option<Self>

Source

fn sqrt_exact(&self) -> Option<Self>

Source

fn cbrt_exact(&self) -> Option<Self>

Source

fn is_nth_power(&self, n: u32) -> bool

Source

fn is_square(&self) -> bool

Source

fn is_cubic(&self) -> bool

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 ExactRoots for i8

Source§

fn sqrt_exact(&self) -> Option<Self>

Source§

impl ExactRoots for i16

Source§

fn sqrt_exact(&self) -> Option<Self>

Source§

impl ExactRoots for i32

Source§

fn sqrt_exact(&self) -> Option<Self>

Source§

impl ExactRoots for i64

Source§

fn sqrt_exact(&self) -> Option<Self>

Source§

impl ExactRoots for i128

Source§

fn sqrt_exact(&self) -> Option<Self>

Source§

impl ExactRoots for isize

Source§

fn sqrt_exact(&self) -> Option<Self>

Source§

impl ExactRoots for u8

Source§

fn sqrt_exact(&self) -> Option<Self>

Source§

impl ExactRoots for u16

Source§

fn sqrt_exact(&self) -> Option<Self>

Source§

impl ExactRoots for u32

Source§

fn sqrt_exact(&self) -> Option<Self>

Source§

impl ExactRoots for u64

Source§

fn sqrt_exact(&self) -> Option<Self>

Source§

impl ExactRoots for u128

Source§

fn sqrt_exact(&self) -> Option<Self>

Source§

impl ExactRoots for usize

Source§

fn sqrt_exact(&self) -> Option<Self>

Source§

impl ExactRoots for BigInt

Source§

fn sqrt_exact(&self) -> Option<Self>

Source§

fn cbrt_exact(&self) -> Option<Self>

Source§

impl ExactRoots for BigUint

Source§

fn sqrt_exact(&self) -> Option<Self>

Source§

fn cbrt_exact(&self) -> Option<Self>

Implementors§

Source§

impl<T: Integer + Clone + ExactRoots, R: Reducer<T> + Clone> ExactRoots for Mint<T, R>