Trait FixedUnsigned

Source
pub trait FixedUnsigned: Fixed {
    // Required methods
    fn is_power_of_two(self) -> bool;
    fn next_power_of_two(self) -> Self;
    fn checked_next_power_of_two(self) -> Option<Self>;
}
Expand description

This trait provides methods common to all unsigned fixed-point numbers.

Methods common to all fixed-point numbers including signed fixed-point numbers are provided by the Fixed supertrait.

This trait is sealed and cannot be implemented for more types; it is implemented for FixedU8, FixedU16, FixedU32, FixedU64, and FixedU128.

Required Methods§

Source

fn is_power_of_two(self) -> bool

Returns true if the fixed-point number is 2k for some integer k.

Source

fn next_power_of_two(self) -> Self

Returns the smallest power of two that is ≥ self.

Source

fn checked_next_power_of_two(self) -> Option<Self>

Returns the smallest power of two that is ≥ self, or None if the next power of two is too large to represent.

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.

Implementors§

Source§

impl<Frac: LeEqU8> FixedUnsigned for FixedU8<Frac>

Source§

impl<Frac: LeEqU16> FixedUnsigned for FixedU16<Frac>

Source§

impl<Frac: LeEqU32> FixedUnsigned for FixedU32<Frac>

Source§

impl<Frac: LeEqU64> FixedUnsigned for FixedU64<Frac>

Source§

impl<Frac: LeEqU128> FixedUnsigned for FixedU128<Frac>