Trait rug::ops::NegAssign

source ·
pub trait NegAssign {
    fn neg_assign(&mut self);
}
Expand description

Compound negation and assignment.

Examples

use rug::ops::NegAssign;
struct I(i32);
impl NegAssign for I {
    fn neg_assign(&mut self) {
        self.0 = -self.0;
    }
}
let mut i = I(42);
i.neg_assign();
assert_eq!(i.0, -42);

Required Methods

Peforms the negation.

Examples
use rug::ops::NegAssign;
use rug::Integer;
let mut i = Integer::from(-42);
i.neg_assign();
assert_eq!(i, 42);

Implementations on Foreign Types

Implementors