Trait typenum::type_operators::Pow

source ·
pub trait Pow<Exp> {
    type Output;

    // Required method
    fn powi(self, exp: Exp) -> Self::Output;
}
Expand description

A type operator that provides exponentiation by repeated squaring.

§Example

use typenum::{Integer, Pow, N3, P3};

assert_eq!(<N3 as Pow<P3>>::Output::to_i32(), -27);

Required Associated Types§

source

type Output

The result of the exponentiation.

Required Methods§

source

fn powi(self, exp: Exp) -> Self::Output

This function isn’t used in this crate, but may be useful for others. It is implemented for primitives.

§Example
use typenum::{Pow, U3};

let a = 7u32.powi(U3::new());
let b = 7u32.pow(3);
assert_eq!(a, b);

let x = 3.0.powi(U3::new());
let y = 27.0;
assert_eq!(x, y);

Implementations on Foreign Types§

source§

impl Pow<Z0> for f32

source§

type Output = f32

source§

fn powi(self, _: Z0) -> Self::Output

source§

impl Pow<Z0> for f64

source§

type Output = f64

source§

fn powi(self, _: Z0) -> Self::Output

source§

impl Pow<Z0> for i8

source§

type Output = i8

source§

fn powi(self, _: Z0) -> Self::Output

source§

impl Pow<Z0> for i16

source§

type Output = i16

source§

fn powi(self, _: Z0) -> Self::Output

source§

impl Pow<Z0> for i32

source§

type Output = i32

source§

fn powi(self, _: Z0) -> Self::Output

source§

impl Pow<Z0> for i64

source§

type Output = i64

source§

fn powi(self, _: Z0) -> Self::Output

source§

impl Pow<Z0> for isize

source§

type Output = isize

source§

fn powi(self, _: Z0) -> Self::Output

source§

impl Pow<Z0> for u8

source§

type Output = u8

source§

fn powi(self, _: Z0) -> Self::Output

source§

impl Pow<Z0> for u16

source§

type Output = u16

source§

fn powi(self, _: Z0) -> Self::Output

source§

impl Pow<Z0> for u32

source§

type Output = u32

source§

fn powi(self, _: Z0) -> Self::Output

source§

impl Pow<Z0> for u64

source§

type Output = u64

source§

fn powi(self, _: Z0) -> Self::Output

source§

impl Pow<Z0> for usize

source§

type Output = usize

source§

fn powi(self, _: Z0) -> Self::Output

source§

impl Pow<UTerm> for f32

source§

type Output = f32

source§

fn powi(self, _: UTerm) -> Self::Output

source§

impl Pow<UTerm> for f64

source§

type Output = f64

source§

fn powi(self, _: UTerm) -> Self::Output

source§

impl Pow<UTerm> for i8

source§

type Output = i8

source§

fn powi(self, _: UTerm) -> Self::Output

source§

impl Pow<UTerm> for i16

source§

type Output = i16

source§

fn powi(self, _: UTerm) -> Self::Output

source§

impl Pow<UTerm> for i32

source§

type Output = i32

source§

fn powi(self, _: UTerm) -> Self::Output

source§

impl Pow<UTerm> for i64

source§

type Output = i64

source§

fn powi(self, _: UTerm) -> Self::Output

source§

impl Pow<UTerm> for isize

source§

type Output = isize

source§

fn powi(self, _: UTerm) -> Self::Output

source§

impl Pow<UTerm> for u8

source§

type Output = u8

source§

fn powi(self, _: UTerm) -> Self::Output

source§

impl Pow<UTerm> for u16

source§

type Output = u16

source§

fn powi(self, _: UTerm) -> Self::Output

source§

impl Pow<UTerm> for u32

source§

type Output = u32

source§

fn powi(self, _: UTerm) -> Self::Output

source§

impl Pow<UTerm> for u64

source§

type Output = u64

source§

fn powi(self, _: UTerm) -> Self::Output

source§

impl Pow<UTerm> for usize

source§

type Output = usize

source§

fn powi(self, _: UTerm) -> Self::Output

source§

impl<U: Unsigned + NonZero> Pow<NInt<U>> for f32

source§

type Output = f32

source§

fn powi(self, _: NInt<U>) -> Self::Output

source§

impl<U: Unsigned + NonZero> Pow<NInt<U>> for f64

source§

type Output = f64

source§

fn powi(self, _: NInt<U>) -> Self::Output

source§

impl<U: Unsigned + NonZero> Pow<PInt<U>> for f32

source§

type Output = f32

source§

fn powi(self, _: PInt<U>) -> Self::Output

source§

impl<U: Unsigned + NonZero> Pow<PInt<U>> for f64

source§

type Output = f64

source§

fn powi(self, _: PInt<U>) -> Self::Output

source§

impl<U: Unsigned + NonZero> Pow<PInt<U>> for i8

source§

type Output = i8

source§

fn powi(self, _: PInt<U>) -> Self::Output

source§

impl<U: Unsigned + NonZero> Pow<PInt<U>> for i16

source§

type Output = i16

source§

fn powi(self, _: PInt<U>) -> Self::Output

source§

impl<U: Unsigned + NonZero> Pow<PInt<U>> for i32

source§

type Output = i32

source§

fn powi(self, _: PInt<U>) -> Self::Output

source§

impl<U: Unsigned + NonZero> Pow<PInt<U>> for i64

source§

type Output = i64

source§

fn powi(self, _: PInt<U>) -> Self::Output

source§

impl<U: Unsigned + NonZero> Pow<PInt<U>> for isize

source§

type Output = isize

source§

fn powi(self, _: PInt<U>) -> Self::Output

source§

impl<U: Unsigned + NonZero> Pow<PInt<U>> for u8

source§

type Output = u8

source§

fn powi(self, _: PInt<U>) -> Self::Output

source§

impl<U: Unsigned + NonZero> Pow<PInt<U>> for u16

source§

type Output = u16

source§

fn powi(self, _: PInt<U>) -> Self::Output

source§

impl<U: Unsigned + NonZero> Pow<PInt<U>> for u32

source§

type Output = u32

source§

fn powi(self, _: PInt<U>) -> Self::Output

source§

impl<U: Unsigned + NonZero> Pow<PInt<U>> for u64

source§

type Output = u64

source§

fn powi(self, _: PInt<U>) -> Self::Output

source§

impl<U: Unsigned + NonZero> Pow<PInt<U>> for usize

source§

type Output = usize

source§

fn powi(self, _: PInt<U>) -> Self::Output

source§

impl<U: Unsigned, B: Bit> Pow<UInt<U, B>> for f32

source§

type Output = f32

source§

fn powi(self, _: UInt<U, B>) -> Self::Output

source§

impl<U: Unsigned, B: Bit> Pow<UInt<U, B>> for f64

source§

type Output = f64

source§

fn powi(self, _: UInt<U, B>) -> Self::Output

source§

impl<U: Unsigned, B: Bit> Pow<UInt<U, B>> for i8

source§

type Output = i8

source§

fn powi(self, _: UInt<U, B>) -> Self::Output

source§

impl<U: Unsigned, B: Bit> Pow<UInt<U, B>> for i16

source§

type Output = i16

source§

fn powi(self, _: UInt<U, B>) -> Self::Output

source§

impl<U: Unsigned, B: Bit> Pow<UInt<U, B>> for i32

source§

type Output = i32

source§

fn powi(self, _: UInt<U, B>) -> Self::Output

source§

impl<U: Unsigned, B: Bit> Pow<UInt<U, B>> for i64

source§

type Output = i64

source§

fn powi(self, _: UInt<U, B>) -> Self::Output

source§

impl<U: Unsigned, B: Bit> Pow<UInt<U, B>> for isize

source§

type Output = isize

source§

fn powi(self, _: UInt<U, B>) -> Self::Output

source§

impl<U: Unsigned, B: Bit> Pow<UInt<U, B>> for u8

source§

type Output = u8

source§

fn powi(self, _: UInt<U, B>) -> Self::Output

source§

impl<U: Unsigned, B: Bit> Pow<UInt<U, B>> for u16

source§

type Output = u16

source§

fn powi(self, _: UInt<U, B>) -> Self::Output

source§

impl<U: Unsigned, B: Bit> Pow<UInt<U, B>> for u32

source§

type Output = u32

source§

fn powi(self, _: UInt<U, B>) -> Self::Output

source§

impl<U: Unsigned, B: Bit> Pow<UInt<U, B>> for u64

source§

type Output = u64

source§

fn powi(self, _: UInt<U, B>) -> Self::Output

source§

impl<U: Unsigned, B: Bit> Pow<UInt<U, B>> for usize

source§

type Output = usize

source§

fn powi(self, _: UInt<U, B>) -> Self::Output

Implementors§

source§

impl Pow<Z0> for Z0

0^0 = 1

source§

impl<U: Unsigned + NonZero> Pow<NInt<U>> for Z0

0^N = 0

source§

impl<U: Unsigned + NonZero> Pow<NInt<U>> for P1

1^N = 1

source§

impl<U: Unsigned + NonZero> Pow<PInt<U>> for Z0

0^P = 0

source§

impl<U: Unsigned + NonZero> Pow<Z0> for NInt<U>

N^0 = 1

source§

impl<U: Unsigned + NonZero> Pow<Z0> for PInt<U>

P^0 = 1

source§

impl<U: Unsigned> Pow<NInt<UInt<U, B0>>> for N1

(-1)^N = 1 if N is even

source§

impl<U: Unsigned> Pow<NInt<UInt<U, B1>>> for N1

(-1)^N = -1 if N is odd

source§

impl<Ul, Ur: Unsigned + NonZero> Pow<PInt<Ur>> for PInt<Ul>
where Ul: Pow<Ur> + Unsigned + NonZero, <Ul as Pow<Ur>>::Output: Unsigned + NonZero,

P(Ul)^P(Ur) = P(Ul^Ur)

source§

type Output = PInt<<Ul as Pow<Ur>>::Output>

source§

impl<Ul, Ur: Unsigned> Pow<PInt<UInt<Ur, B0>>> for NInt<Ul>
where Ul: Pow<UInt<Ur, B0>> + Unsigned + NonZero, <Ul as Pow<UInt<Ur, B0>>>::Output: Unsigned + NonZero,

N(Ul)^P(Ur) = P(Ul^Ur) if Ur is even

source§

type Output = PInt<<Ul as Pow<UInt<Ur, B0>>>::Output>

source§

impl<Ul, Ur: Unsigned> Pow<PInt<UInt<Ur, B1>>> for NInt<Ul>
where Ul: Pow<UInt<Ur, B1>> + Unsigned + NonZero, <Ul as Pow<UInt<Ur, B1>>>::Output: Unsigned + NonZero,

N(Ul)^P(Ur) = N(Ul^Ur) if Ur is odd

source§

type Output = NInt<<Ul as Pow<UInt<Ur, B1>>>::Output>

source§

impl<X, N: Unsigned> Pow<N> for X
where X: PrivatePow<U1, N> + Unsigned,

X^N

source§

type Output = <X as PrivatePow<UInt<UTerm, B1>, N>>::Output