Trait ethers::core::k256::elliptic_curve::ops::SubAssign1.8.0[][src]

pub trait SubAssign<Rhs = Self> {
    fn sub_assign(&mut self, rhs: Rhs);
}
Expand description

The subtraction assignment operator -=.

Examples

This example creates a Point struct that implements the SubAssign trait, and then demonstrates sub-assigning to a mutable Point.

use std::ops::SubAssign;

#[derive(Debug, Copy, Clone, PartialEq)]
struct Point {
    x: i32,
    y: i32,
}

impl SubAssign for Point {
    fn sub_assign(&mut self, other: Self) {
        *self = Self {
            x: self.x - other.x,
            y: self.y - other.y,
        };
    }
}

let mut point = Point { x: 3, y: 3 };
point -= Point { x: 2, y: 3 };
assert_eq!(point, Point {x: 1, y: 0});

Required methods

Performs the -= operation.

Example
let mut x: u32 = 12;
x -= 1;
assert_eq!(x, 11);

Implementations on Foreign Types

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Subtracts another BitVec from self, assuming 2’s-complement encoding.

The minuend is zero-extended, or the subtrahend sign-extended, as needed to ensure that the vectors are the same width before subtraction occurs.

The Sub trait has more documentation on the subtraction process.

Numeric arithmetic is provided on BitVec as a convenience. Serious numeric computation on variable-length integers should use the num_bigint crate instead, which is written specifically for that use case. BitVecs are not intended for arithmetic, and bitvec makes no guarantees about sustained correctness in arithmetic at this time.

Subtracts another BitVec from self.

Examples
use bitvec::prelude::*;

let a = bitvec![0, 0, 0, 1];
let b = bitvec![0, 0, 0, 0];
let c = a - b;
assert_eq!(c, bitvec![0, 0, 0, 1]);

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Disables all flags enabled in the set.

Implementors