Raises a value to the power of exp. Note that 0⁰ (pow(0, 0)) returns 1. Mathematically this is undefined.

Signature

pub trait Pow

Panics

Panics if the result of the exponentiation operation overflows the output type.

Examples

use core::num::traits::Pow;

assert!(2_i8.pow(4_usize) == 16_i8);
assert!(6_u8.pow(3_usize) == 216_u8);
assert!(0_u8.pow(0_usize) == 1_u8);

Trait functions

pow

Returns self to the power exp.

Signature

fn pow(self: Base, exp: Exp) -> PowOutput

Trait types

Output

The type of the result of the power calculation.

Signature

type Output;