[][src]Trait funty::IsUnsigned

pub trait IsUnsigned: IsInteger {
    pub fn is_power_of_two(self) -> bool;
pub fn next_power_of_two(self) -> Self;
pub fn checked_next_power_of_two(self) -> Option<Self>; }

Declare that a type is an unsigned integer.

Required methods

pub fn is_power_of_two(self) -> bool[src]

Returns true if and only if self == 2^k for some k.

pub fn next_power_of_two(self) -> Self[src]

Returns the smallest power of two greater than or equal to self.

When return value overflows (i.e., self > (1 << (N-1)) for type uN), it panics in debug mode and return value is wrapped to 0 in release mode (the only situation in which method can return 0).

pub fn checked_next_power_of_two(self) -> Option<Self>[src]

Returns the smallest power of two greater than or equal to n. If the next power of two is greater than the type’s maximum value, None is returned, otherwise the power of two is wrapped in Some.

Loading content...

Implementations on Foreign Types

impl IsUnsigned for u8[src]

impl IsUnsigned for u16[src]

impl IsUnsigned for u32[src]

impl IsUnsigned for u64[src]

impl IsUnsigned for u128[src]

impl IsUnsigned for usize[src]

Loading content...

Implementors

Loading content...