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

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

fn pow_from(&mut self, lhs: Lhs)

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);
Loading content...

Implementations on Foreign Types

impl PowFrom<u32> for u32[src]

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

impl PowFrom<f32> for f32[src]

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

impl PowFrom<f64> for f64[src]

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

Loading content...

Implementors

impl PowFrom<f32> for Float[src]

impl PowFrom<f64> for Float[src]

impl PowFrom<i32> for Float[src]

impl PowFrom<u32> for Float[src]

impl PowFrom<Complex> for Complex[src]

impl PowFrom<Float> for Float[src]

impl<'_> PowFrom<&'_ f32> for Float[src]

impl<'_> PowFrom<&'_ f64> for Float[src]

impl<'_> PowFrom<&'_ i32> for Float[src]

impl<'_> PowFrom<&'_ u32> for Float[src]

impl<'_> PowFrom<&'_ Complex> for Complex[src]

impl<'_> PowFrom<&'_ Float> for Float[src]

Loading content...