pub trait ConstIlog:
Sized
+ ConstZero
+ ConstOne
+ Ord
+ Div<Output = Self> {
// Required methods
fn ilog2(self) -> u32;
fn ilog10(self) -> u32;
fn ilog(self, base: Self) -> u32;
fn checked_ilog2(self) -> Option<u32>;
fn checked_ilog10(self) -> Option<u32>;
fn checked_ilog(self, base: Self) -> Option<u32>;
}Expand description
Const-compatible integer logarithm operations.
§Unsigned types only
This trait is designed for unsigned integer types. The logarithm of zero
is undefined and will panic (or return None for checked variants).
Required Methods§
Sourcefn ilog(self, base: Self) -> u32
fn ilog(self, base: Self) -> u32
Returns the logarithm of the number with respect to an arbitrary base, rounded down.
§Panics
Panics if self is zero, or if base is less than 2.
Sourcefn checked_ilog2(self) -> Option<u32>
fn checked_ilog2(self) -> Option<u32>
Returns the base 2 logarithm of the number, rounded down.
Returns None if self is zero.
Sourcefn checked_ilog10(self) -> Option<u32>
fn checked_ilog10(self) -> Option<u32>
Returns the base 10 logarithm of the number, rounded down.
Returns None if self is zero.
Sourcefn checked_ilog(self, base: Self) -> Option<u32>
fn checked_ilog(self, base: Self) -> Option<u32>
Returns the logarithm of the number with respect to an arbitrary base, rounded down.
Returns None if self is zero, or if base is less than 2.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".