Skip to main content

CheckedIsqrt

Trait CheckedIsqrt 

Source
pub trait CheckedIsqrt: Sized {
    type Output;

    // Required method
    fn checked_isqrt(self) -> Option<Self::Output>;
}
Expand description

Integer square root of signed values, None for negative inputs.

Required Associated Types§

Source

type Output

Returns the integer square root, or None if self is negative. Like std, this is only provided for signed types.

use const_num_traits::CheckedIsqrt;

assert_eq!(CheckedIsqrt::checked_isqrt(10i32), Some(3));
assert_eq!(CheckedIsqrt::checked_isqrt(-1i32), None);

Required Methods§

Source

fn checked_isqrt(self) -> Option<Self::Output>

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

Source§

impl CheckedIsqrt for i16

Source§

impl CheckedIsqrt for i32

Source§

impl CheckedIsqrt for i64

Source§

impl CheckedIsqrt for i128

Source§

impl CheckedIsqrt for isize

Implementors§