Skip to main content

CnextPowerOfTwo

Trait CnextPowerOfTwo 

Source
pub trait CnextPowerOfTwo: Sized {
    type Output;
    type Error;

    // Required method
    fn cnext_power_of_two(self) -> Result<Self::Output, Self::Error>;
}
Expand description

Checked next power of 2, returning an error if overflow occured.

See also: module documentation.

Required Associated Types§

Required Methods§

Source

fn cnext_power_of_two(self) -> Result<Self::Output, Self::Error>

Checked next power of 2, returning an error if overflow occured.

Wrapper for checked_next_power_of_two.

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 CnextPowerOfTwo for NonZero<u8>

Source§

fn cnext_power_of_two(self) -> Result<NonZero<u8>, Error>

Checked next power of 2, returning an error if overflow occured.

Wrapper for NonZero<u8>::checked_next_power_of_two.

Source§

type Output = NonZero<u8>

Source§

type Error = Error

Source§

impl CnextPowerOfTwo for NonZero<u16>

Source§

fn cnext_power_of_two(self) -> Result<NonZero<u16>, Error>

Checked next power of 2, returning an error if overflow occured.

Wrapper for NonZero<u16>::checked_next_power_of_two.

Source§

type Output = NonZero<u16>

Source§

type Error = Error

Source§

impl CnextPowerOfTwo for NonZero<u32>

Source§

fn cnext_power_of_two(self) -> Result<NonZero<u32>, Error>

Checked next power of 2, returning an error if overflow occured.

Wrapper for NonZero<u32>::checked_next_power_of_two.

Source§

type Output = NonZero<u32>

Source§

type Error = Error

Source§

impl CnextPowerOfTwo for NonZero<u64>

Source§

fn cnext_power_of_two(self) -> Result<NonZero<u64>, Error>

Checked next power of 2, returning an error if overflow occured.

Wrapper for NonZero<u64>::checked_next_power_of_two.

Source§

type Output = NonZero<u64>

Source§

type Error = Error

Source§

impl CnextPowerOfTwo for NonZero<u128>

Source§

fn cnext_power_of_two(self) -> Result<NonZero<u128>, Error>

Checked next power of 2, returning an error if overflow occured.

Wrapper for NonZero<u128>::checked_next_power_of_two.

Source§

type Output = NonZero<u128>

Source§

type Error = Error

Source§

impl CnextPowerOfTwo for NonZero<usize>

Source§

fn cnext_power_of_two(self) -> Result<NonZero<usize>, Error>

Checked next power of 2, returning an error if overflow occured.

Wrapper for NonZero<usize>::checked_next_power_of_two.

Source§

type Output = NonZero<usize>

Source§

type Error = Error

Source§

impl CnextPowerOfTwo for u8

Source§

fn cnext_power_of_two(self) -> Result<u8, Error>

Checked next power of 2, returning an error if overflow occured.

Wrapper for u8::checked_next_power_of_two.

Source§

type Output = u8

Source§

type Error = Error

Source§

impl CnextPowerOfTwo for u16

Source§

fn cnext_power_of_two(self) -> Result<u16, Error>

Checked next power of 2, returning an error if overflow occured.

Wrapper for u16::checked_next_power_of_two.

Source§

type Output = u16

Source§

type Error = Error

Source§

impl CnextPowerOfTwo for u32

Source§

fn cnext_power_of_two(self) -> Result<u32, Error>

Checked next power of 2, returning an error if overflow occured.

Wrapper for u32::checked_next_power_of_two.

Source§

type Output = u32

Source§

type Error = Error

Source§

impl CnextPowerOfTwo for u64

Source§

fn cnext_power_of_two(self) -> Result<u64, Error>

Checked next power of 2, returning an error if overflow occured.

Wrapper for u64::checked_next_power_of_two.

Source§

type Output = u64

Source§

type Error = Error

Source§

impl CnextPowerOfTwo for u128

Source§

fn cnext_power_of_two(self) -> Result<u128, Error>

Checked next power of 2, returning an error if overflow occured.

Wrapper for u128::checked_next_power_of_two.

Source§

type Output = u128

Source§

type Error = Error

Source§

impl CnextPowerOfTwo for usize

Source§

fn cnext_power_of_two(self) -> Result<usize, Error>

Checked next power of 2, returning an error if overflow occured.

Wrapper for usize::checked_next_power_of_two.

Source§

type Output = usize

Source§

type Error = Error

Implementors§