referrerpolicy=no-referrer-when-downgrade
pub trait IntegerSquareRoot {
    // Required method
    fn integer_sqrt_checked(&self) -> Option<Self>
       where Self: Sized;

    // Provided method
    fn integer_sqrt(&self) -> Self
       where Self: Sized { ... }
}
Expand description

A trait implementing integer square root.

Required Methods§

fn integer_sqrt_checked(&self) -> Option<Self>
where Self: Sized,

Find the integer square root, returning None if the number is negative (this can never happen for unsigned types).

Provided Methods§

fn integer_sqrt(&self) -> Self
where Self: Sized,

Find the integer square root.

See Integer_square_root on wikipedia for more information (and also the source of this algorithm)

§Panics

For negative numbers (i family) this function will panic on negative input

Implementations on Foreign Types§

§

impl IntegerSquareRoot for U128

§

fn integer_sqrt_checked(&self) -> Option<U128>

§

impl IntegerSquareRoot for U128

§

fn integer_sqrt_checked(&self) -> Option<U128>

§

impl IntegerSquareRoot for U256

§

fn integer_sqrt_checked(&self) -> Option<U256>

§

impl IntegerSquareRoot for U256

§

fn integer_sqrt_checked(&self) -> Option<U256>

§

impl IntegerSquareRoot for U512

§

fn integer_sqrt_checked(&self) -> Option<U512>

§

impl IntegerSquareRoot for U512

§

fn integer_sqrt_checked(&self) -> Option<U512>

Implementors§

§

impl<T> IntegerSquareRoot for T
where T: PrimInt,