Trait rug::ops::PowFrom [] [src]

pub trait PowFrom<Lhs = Self> {
    fn pow_from(&mut self, lhs: Lhs);
}

Compound power operation and assignment to the rhs operand.

rhs.pow_from(lhs) has the same effect as rhs = lhs.pow(rhs).

Examples

use rug::ops::PowFrom;
struct U(u32);
impl PowFrom<u32> for U {
    fn pow_from(&mut self, lhs: u32) {
        self.0 = lhs.pow(self.0);
    }
}
let mut u = U(2);
u.pow_from(5);
assert_eq!(u.0, 25);

Required Methods

Peforms the power operation.

Examples

use rug::Float;
use rug::ops::PowFrom;
let mut rhs = Float::with_val(53, 5);
rhs.pow_from(10);
// rhs = 10 ** 5
assert_eq!(rhs, 100_000);

Implementations on Foreign Types

impl PowFrom for u32
[src]

[src]

impl<'a> PowFrom<&'a u32> for u32
[src]

[src]

impl PowFrom for f32
[src]

[src]

impl<'a> PowFrom<&'a f32> for f32
[src]

[src]

impl PowFrom for f64
[src]

[src]

impl<'a> PowFrom<&'a f64> for f64
[src]

[src]

Implementors