Trait PowerOf2

Source
pub trait PowerOf2<POW> {
    // Required method
    fn power_of_2(pow: POW) -> Self;
}
Expand description

Raises 2 to a power.

Required Methods§

Source

fn power_of_2(pow: POW) -> Self

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.

Implementations on Foreign Types§

Source§

impl PowerOf2<i64> for f32

Source§

fn power_of_2(pow: i64) -> f32

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the power is smaller than Self::MIN_EXPONENT or greater than Self::MAX_EXPONENT.

§Examples

See here.

Source§

impl PowerOf2<i64> for f64

Source§

fn power_of_2(pow: i64) -> f64

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the power is smaller than Self::MIN_EXPONENT or greater than Self::MAX_EXPONENT.

§Examples

See here.

Source§

impl PowerOf2<u64> for i8

Source§

fn power_of_2(pow: u64) -> i8

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

Source§

impl PowerOf2<u64> for i16

Source§

fn power_of_2(pow: u64) -> i16

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

Source§

impl PowerOf2<u64> for i32

Source§

fn power_of_2(pow: u64) -> i32

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

Source§

impl PowerOf2<u64> for i64

Source§

fn power_of_2(pow: u64) -> i64

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

Source§

impl PowerOf2<u64> for i128

Source§

fn power_of_2(pow: u64) -> i128

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

Source§

impl PowerOf2<u64> for isize

Source§

fn power_of_2(pow: u64) -> isize

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

Source§

impl PowerOf2<u64> for u8

Source§

fn power_of_2(pow: u64) -> u8

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

Source§

impl PowerOf2<u64> for u16

Source§

fn power_of_2(pow: u64) -> u16

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

Source§

impl PowerOf2<u64> for u32

Source§

fn power_of_2(pow: u64) -> u32

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

Source§

impl PowerOf2<u64> for u64

Source§

fn power_of_2(pow: u64) -> u64

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

Source§

impl PowerOf2<u64> for u128

Source§

fn power_of_2(pow: u64) -> u128

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

Source§

impl PowerOf2<u64> for usize

Source§

fn power_of_2(pow: u64) -> usize

Raises 2 to an integer power.

$f(k) = 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if the result is not representable.

§Examples

See here.

Implementors§