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<UTerm> for u64

§

type Output = u64

source§

fn powi(self, _: UTerm) -> <u64 as Pow<UTerm>>::Output

source§

impl Pow<UTerm> for u32

§

type Output = u32

source§

fn powi(self, _: UTerm) -> <u32 as Pow<UTerm>>::Output

source§

impl<U> Pow<PInt<U>> for u16where U: Unsigned + NonZero,

§

type Output = u16

source§

fn powi(self, _: PInt<U>) -> <u16 as Pow<PInt<U>>>::Output

source§

impl Pow<Z0> for i8

§

type Output = i8

source§

fn powi(self, _: Z0) -> <i8 as Pow<Z0>>::Output

source§

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

§

type Output = i16

source§

fn powi(self, _: UInt<U, B>) -> <i16 as Pow<UInt<U, B>>>::Output

source§

impl Pow<Z0> for i64

§

type Output = i64

source§

fn powi(self, _: Z0) -> <i64 as Pow<Z0>>::Output

source§

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

§

type Output = i8

source§

fn powi(self, _: UInt<U, B>) -> <i8 as Pow<UInt<U, B>>>::Output

source§

impl<U> Pow<PInt<U>> for i64where U: Unsigned + NonZero,

§

type Output = i64

source§

fn powi(self, _: PInt<U>) -> <i64 as Pow<PInt<U>>>::Output

source§

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

§

type Output = isize

source§

fn powi(self, _: UInt<U, B>) -> <isize as Pow<UInt<U, B>>>::Output

source§

impl Pow<Z0> for isize

§

type Output = isize

source§

fn powi(self, _: Z0) -> <isize as Pow<Z0>>::Output

source§

impl Pow<UTerm> for u16

§

type Output = u16

source§

fn powi(self, _: UTerm) -> <u16 as Pow<UTerm>>::Output

source§

impl<U> Pow<PInt<U>> for isizewhere U: Unsigned + NonZero,

§

type Output = isize

source§

fn powi(self, _: PInt<U>) -> <isize as Pow<PInt<U>>>::Output

source§

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

§

type Output = u32

source§

fn powi(self, _: UInt<U, B>) -> <u32 as Pow<UInt<U, B>>>::Output

source§

impl<U> Pow<NInt<U>> for f32where U: Unsigned + NonZero,

§

type Output = f32

source§

fn powi(self, _: NInt<U>) -> <f32 as Pow<NInt<U>>>::Output

source§

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

§

type Output = f32

source§

fn powi(self, _: UInt<U, B>) -> <f32 as Pow<UInt<U, B>>>::Output

source§

impl<U> Pow<PInt<U>> for u8where U: Unsigned + NonZero,

§

type Output = u8

source§

fn powi(self, _: PInt<U>) -> <u8 as Pow<PInt<U>>>::Output

source§

impl Pow<Z0> for u8

§

type Output = u8

source§

fn powi(self, _: Z0) -> <u8 as Pow<Z0>>::Output

source§

impl Pow<Z0> for u64

§

type Output = u64

source§

fn powi(self, _: Z0) -> <u64 as Pow<Z0>>::Output

source§

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

§

type Output = i32

source§

fn powi(self, _: UInt<U, B>) -> <i32 as Pow<UInt<U, B>>>::Output

source§

impl Pow<Z0> for i32

§

type Output = i32

source§

fn powi(self, _: Z0) -> <i32 as Pow<Z0>>::Output

source§

impl Pow<Z0> for u32

§

type Output = u32

source§

fn powi(self, _: Z0) -> <u32 as Pow<Z0>>::Output

source§

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

§

type Output = i64

source§

fn powi(self, _: UInt<U, B>) -> <i64 as Pow<UInt<U, B>>>::Output

source§

impl<U> Pow<PInt<U>> for i16where U: Unsigned + NonZero,

§

type Output = i16

source§

fn powi(self, _: PInt<U>) -> <i16 as Pow<PInt<U>>>::Output

source§

impl<U> Pow<PInt<U>> for u64where U: Unsigned + NonZero,

§

type Output = u64

source§

fn powi(self, _: PInt<U>) -> <u64 as Pow<PInt<U>>>::Output

source§

impl Pow<Z0> for f64

§

type Output = f64

source§

fn powi(self, _: Z0) -> <f64 as Pow<Z0>>::Output

source§

impl Pow<UTerm> for f32

§

type Output = f32

source§

fn powi(self, _: UTerm) -> <f32 as Pow<UTerm>>::Output

source§

impl<U> Pow<PInt<U>> for f32where U: Unsigned + NonZero,

§

type Output = f32

source§

fn powi(self, _: PInt<U>) -> <f32 as Pow<PInt<U>>>::Output

source§

impl<U> Pow<PInt<U>> for u32where U: Unsigned + NonZero,

§

type Output = u32

source§

fn powi(self, _: PInt<U>) -> <u32 as Pow<PInt<U>>>::Output

source§

impl<U> Pow<PInt<U>> for i32where U: Unsigned + NonZero,

§

type Output = i32

source§

fn powi(self, _: PInt<U>) -> <i32 as Pow<PInt<U>>>::Output

source§

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

§

type Output = u8

source§

fn powi(self, _: UInt<U, B>) -> <u8 as Pow<UInt<U, B>>>::Output

source§

impl<U> Pow<NInt<U>> for f64where U: Unsigned + NonZero,

§

type Output = f64

source§

fn powi(self, _: NInt<U>) -> <f64 as Pow<NInt<U>>>::Output

source§

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

§

type Output = f64

source§

fn powi(self, _: UInt<U, B>) -> <f64 as Pow<UInt<U, B>>>::Output

source§

impl Pow<UTerm> for u8

§

type Output = u8

source§

fn powi(self, _: UTerm) -> <u8 as Pow<UTerm>>::Output

source§

impl Pow<Z0> for u16

§

type Output = u16

source§

fn powi(self, _: Z0) -> <u16 as Pow<Z0>>::Output

source§

impl Pow<UTerm> for i8

§

type Output = i8

source§

fn powi(self, _: UTerm) -> <i8 as Pow<UTerm>>::Output

source§

impl Pow<UTerm> for isize

§

type Output = isize

source§

fn powi(self, _: UTerm) -> <isize as Pow<UTerm>>::Output

source§

impl Pow<UTerm> for i32

§

type Output = i32

source§

fn powi(self, _: UTerm) -> <i32 as Pow<UTerm>>::Output

source§

impl<U> Pow<PInt<U>> for usizewhere U: Unsigned + NonZero,

§

type Output = usize

source§

fn powi(self, _: PInt<U>) -> <usize as Pow<PInt<U>>>::Output

source§

impl<U> Pow<PInt<U>> for i8where U: Unsigned + NonZero,

§

type Output = i8

source§

fn powi(self, _: PInt<U>) -> <i8 as Pow<PInt<U>>>::Output

source§

impl Pow<UTerm> for i64

§

type Output = i64

source§

fn powi(self, _: UTerm) -> <i64 as Pow<UTerm>>::Output

source§

impl Pow<UTerm> for i16

§

type Output = i16

source§

fn powi(self, _: UTerm) -> <i16 as Pow<UTerm>>::Output

source§

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

§

type Output = u64

source§

fn powi(self, _: UInt<U, B>) -> <u64 as Pow<UInt<U, B>>>::Output

source§

impl Pow<Z0> for usize

§

type Output = usize

source§

fn powi(self, _: Z0) -> <usize as Pow<Z0>>::Output

source§

impl Pow<UTerm> for f64

§

type Output = f64

source§

fn powi(self, _: UTerm) -> <f64 as Pow<UTerm>>::Output

source§

impl Pow<Z0> for f32

§

type Output = f32

source§

fn powi(self, _: Z0) -> <f32 as Pow<Z0>>::Output

source§

impl<U> Pow<PInt<U>> for f64where U: Unsigned + NonZero,

§

type Output = f64

source§

fn powi(self, _: PInt<U>) -> <f64 as Pow<PInt<U>>>::Output

source§

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

§

type Output = usize

source§

fn powi(self, _: UInt<U, B>) -> <usize as Pow<UInt<U, B>>>::Output

source§

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

§

type Output = u16

source§

fn powi(self, _: UInt<U, B>) -> <u16 as Pow<UInt<U, B>>>::Output

source§

impl Pow<UTerm> for usize

§

type Output = usize

source§

fn powi(self, _: UTerm) -> <usize as Pow<UTerm>>::Output

source§

impl Pow<Z0> for i16

§

type Output = i16

source§

fn powi(self, _: Z0) -> <i16 as Pow<Z0>>::Output

Implementors§

source§

impl Pow<Z0> for Z0

0^0 = 1

source§

impl<U> Pow<NInt<UInt<U, B0>>> for NInt<UInt<UTerm, B1>>where U: Unsigned,

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

source§

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

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

source§

impl<U> Pow<NInt<U>> for PInt<UInt<UTerm, B1>>where U: Unsigned + NonZero,

1^N = 1

source§

impl<U> Pow<NInt<U>> for Z0where U: Unsigned + NonZero,

0^N = 0

§

type Output = Z0

source§

impl<U> Pow<PInt<U>> for Z0where U: Unsigned + NonZero,

0^P = 0

§

type Output = Z0

source§

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

N^0 = 1

source§

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

P^0 = 1

source§

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

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

§

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

source§

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

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

§

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

source§

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

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

§

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

source§

impl<X, N> Pow<N> for Xwhere X: Unsigned + PrivatePow<UInt<UTerm, B1>, N>, N: Unsigned,

X^N

§

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