pub trait AddAssign<Rhs = Self> {
// Required method
fn add_assign(&mut self, rhs: Rhs);
}
Expand description
The addition assignment operator +=
.
§Examples
This example creates a Point
struct that implements the AddAssign
trait, and then demonstrates add-assigning to a mutable Point
.
use std::ops::AddAssign;
#[derive(Debug, Copy, Clone, PartialEq)]
struct Point {
x: i32,
y: i32,
}
impl AddAssign for Point {
fn add_assign(&mut self, other: Self) {
*self = Self {
x: self.x + other.x,
y: self.y + other.y,
};
}
}
let mut point = Point { x: 1, y: 0 };
point += Point { x: 2, y: 3 };
assert_eq!(point, Point { x: 3, y: 3 });
Required Methods§
1.8.0 · sourcefn add_assign(&mut self, rhs: Rhs)
fn add_assign(&mut self, rhs: Rhs)
Implementors§
impl AddAssign for f16
impl AddAssign for f32
impl AddAssign for f64
impl AddAssign for f128
impl AddAssign for i8
impl AddAssign for i16
impl AddAssign for i32
impl AddAssign for i64
impl AddAssign for i128
impl AddAssign for isize
impl AddAssign for u8
impl AddAssign for u16
impl AddAssign for u32
impl AddAssign for u64
impl AddAssign for u128
impl AddAssign for usize
impl AddAssign for Felt
Field addition. Never overflows/underflows.
impl AddAssign for Saturating<i8>
impl AddAssign for Saturating<i16>
impl AddAssign for Saturating<i32>
impl AddAssign for Saturating<i64>
impl AddAssign for Saturating<i128>
impl AddAssign for Saturating<isize>
impl AddAssign for Saturating<u8>
impl AddAssign for Saturating<u16>
impl AddAssign for Saturating<u32>
impl AddAssign for Saturating<u64>
impl AddAssign for Saturating<u128>
impl AddAssign for Saturating<usize>
impl AddAssign for cairo_vm::with_std::num::Wrapping<i8>
impl AddAssign for cairo_vm::with_std::num::Wrapping<i16>
impl AddAssign for cairo_vm::with_std::num::Wrapping<i32>
impl AddAssign for cairo_vm::with_std::num::Wrapping<i64>
impl AddAssign for cairo_vm::with_std::num::Wrapping<i128>
impl AddAssign for cairo_vm::with_std::num::Wrapping<isize>
impl AddAssign for cairo_vm::with_std::num::Wrapping<u8>
impl AddAssign for cairo_vm::with_std::num::Wrapping<u16>
impl AddAssign for cairo_vm::with_std::num::Wrapping<u32>
impl AddAssign for cairo_vm::with_std::num::Wrapping<u64>
impl AddAssign for cairo_vm::with_std::num::Wrapping<u128>
impl AddAssign for cairo_vm::with_std::num::Wrapping<usize>
impl AddAssign for cairo_vm::with_std::time::Duration
impl AddAssign for Checked<Limb>
impl AddAssign for crypto_bigint::wrapping::Wrapping<Limb>
impl AddAssign for BigInt
impl AddAssign for BigUint
impl AddAssign for udouble
impl AddAssign for Decimal
impl AddAssign for starknet_ff::FieldElement
impl AddAssign for starknet_types_core::curve::projective_point::ProjectivePoint
impl AddAssign for time::duration::Duration
impl AddAssign<&f16> for f16
impl AddAssign<&f32> for f32
impl AddAssign<&f64> for f64
impl AddAssign<&f128> for f128
impl AddAssign<&i8> for i8
impl AddAssign<&i8> for Saturating<i8>
impl AddAssign<&i8> for cairo_vm::with_std::num::Wrapping<i8>
impl AddAssign<&i16> for i16
impl AddAssign<&i16> for Saturating<i16>
impl AddAssign<&i16> for cairo_vm::with_std::num::Wrapping<i16>
impl AddAssign<&i32> for i32
impl AddAssign<&i32> for Saturating<i32>
impl AddAssign<&i32> for cairo_vm::with_std::num::Wrapping<i32>
impl AddAssign<&i64> for i64
impl AddAssign<&i64> for Saturating<i64>
impl AddAssign<&i64> for cairo_vm::with_std::num::Wrapping<i64>
impl AddAssign<&i128> for i128
impl AddAssign<&i128> for Saturating<i128>
impl AddAssign<&i128> for cairo_vm::with_std::num::Wrapping<i128>
impl AddAssign<&isize> for isize
impl AddAssign<&isize> for Saturating<isize>
impl AddAssign<&isize> for cairo_vm::with_std::num::Wrapping<isize>
impl AddAssign<&str> for String
Implements the +=
operator for appending to a String
.
This has the same behavior as the push_str
method.
impl AddAssign<&u8> for u8
impl AddAssign<&u8> for Saturating<u8>
impl AddAssign<&u8> for cairo_vm::with_std::num::Wrapping<u8>
impl AddAssign<&u16> for u16
impl AddAssign<&u16> for Saturating<u16>
impl AddAssign<&u16> for cairo_vm::with_std::num::Wrapping<u16>
impl AddAssign<&u32> for u32
impl AddAssign<&u32> for Saturating<u32>
impl AddAssign<&u32> for cairo_vm::with_std::num::Wrapping<u32>
impl AddAssign<&u64> for u64
impl AddAssign<&u64> for Saturating<u64>
impl AddAssign<&u64> for cairo_vm::with_std::num::Wrapping<u64>
impl AddAssign<&u128> for u128
impl AddAssign<&u128> for Saturating<u128>
impl AddAssign<&u128> for cairo_vm::with_std::num::Wrapping<u128>
impl AddAssign<&usize> for usize
impl AddAssign<&usize> for Saturating<usize>
impl AddAssign<&usize> for cairo_vm::with_std::num::Wrapping<usize>
impl AddAssign<&Felt> for Felt
Field addition. Never overflows/underflows.
impl AddAssign<&ExecutionResources> for ExecutionResources
impl AddAssign<&Saturating<i8>> for Saturating<i8>
impl AddAssign<&Saturating<i16>> for Saturating<i16>
impl AddAssign<&Saturating<i32>> for Saturating<i32>
impl AddAssign<&Saturating<i64>> for Saturating<i64>
impl AddAssign<&Saturating<i128>> for Saturating<i128>
impl AddAssign<&Saturating<isize>> for Saturating<isize>
impl AddAssign<&Saturating<u8>> for Saturating<u8>
impl AddAssign<&Saturating<u16>> for Saturating<u16>
impl AddAssign<&Saturating<u32>> for Saturating<u32>
impl AddAssign<&Saturating<u64>> for Saturating<u64>
impl AddAssign<&Saturating<u128>> for Saturating<u128>
impl AddAssign<&Saturating<usize>> for Saturating<usize>
impl AddAssign<&Wrapping<i8>> for cairo_vm::with_std::num::Wrapping<i8>
impl AddAssign<&Wrapping<i16>> for cairo_vm::with_std::num::Wrapping<i16>
impl AddAssign<&Wrapping<i32>> for cairo_vm::with_std::num::Wrapping<i32>
impl AddAssign<&Wrapping<i64>> for cairo_vm::with_std::num::Wrapping<i64>
impl AddAssign<&Wrapping<i128>> for cairo_vm::with_std::num::Wrapping<i128>
impl AddAssign<&Wrapping<isize>> for cairo_vm::with_std::num::Wrapping<isize>
impl AddAssign<&Wrapping<u8>> for cairo_vm::with_std::num::Wrapping<u8>
impl AddAssign<&Wrapping<u16>> for cairo_vm::with_std::num::Wrapping<u16>
impl AddAssign<&Wrapping<u32>> for cairo_vm::with_std::num::Wrapping<u32>
impl AddAssign<&Wrapping<u64>> for cairo_vm::with_std::num::Wrapping<u64>
impl AddAssign<&Wrapping<u128>> for cairo_vm::with_std::num::Wrapping<u128>
impl AddAssign<&Wrapping<usize>> for cairo_vm::with_std::num::Wrapping<usize>
impl AddAssign<&Checked<Limb>> for Checked<Limb>
impl AddAssign<&Wrapping<Limb>> for crypto_bigint::wrapping::Wrapping<Limb>
impl AddAssign<&BigInt> for BigInt
impl AddAssign<&BigUint> for BigUint
impl AddAssign<&AffinePoint> for AffinePoint
impl AddAssign<&AffinePoint> for starknet_curve::ec_point::ProjectivePoint
impl AddAssign<&ProjectivePoint> for starknet_curve::ec_point::ProjectivePoint
impl AddAssign<&AffinePoint> for starknet_types_core::curve::projective_point::ProjectivePoint
impl AddAssign<&ProjectivePoint> for starknet_types_core::curve::projective_point::ProjectivePoint
impl AddAssign<i8> for Saturating<i8>
impl AddAssign<i8> for cairo_vm::with_std::num::Wrapping<i8>
impl AddAssign<i8> for BigInt
impl AddAssign<i16> for Saturating<i16>
impl AddAssign<i16> for cairo_vm::with_std::num::Wrapping<i16>
impl AddAssign<i16> for BigInt
impl AddAssign<i32> for Saturating<i32>
impl AddAssign<i32> for cairo_vm::with_std::num::Wrapping<i32>
impl AddAssign<i32> for BigInt
impl AddAssign<i64> for Saturating<i64>
impl AddAssign<i64> for cairo_vm::with_std::num::Wrapping<i64>
impl AddAssign<i64> for BigInt
impl AddAssign<i128> for Saturating<i128>
impl AddAssign<i128> for cairo_vm::with_std::num::Wrapping<i128>
impl AddAssign<i128> for BigInt
impl AddAssign<isize> for Saturating<isize>
impl AddAssign<isize> for cairo_vm::with_std::num::Wrapping<isize>
impl AddAssign<isize> for BigInt
impl AddAssign<u8> for Saturating<u8>
impl AddAssign<u8> for cairo_vm::with_std::num::Wrapping<u8>
impl AddAssign<u8> for BigInt
impl AddAssign<u8> for BigUint
impl AddAssign<u16> for Saturating<u16>
impl AddAssign<u16> for cairo_vm::with_std::num::Wrapping<u16>
impl AddAssign<u16> for BigInt
impl AddAssign<u16> for BigUint
impl AddAssign<u32> for Saturating<u32>
impl AddAssign<u32> for cairo_vm::with_std::num::Wrapping<u32>
impl AddAssign<u32> for BigInt
impl AddAssign<u32> for BigUint
impl AddAssign<u64> for Saturating<u64>
impl AddAssign<u64> for cairo_vm::with_std::num::Wrapping<u64>
impl AddAssign<u64> for BigInt
impl AddAssign<u64> for BigUint
impl AddAssign<u128> for Saturating<u128>
impl AddAssign<u128> for cairo_vm::with_std::num::Wrapping<u128>
impl AddAssign<u128> for BigInt
impl AddAssign<u128> for BigUint
impl AddAssign<u128> for udouble
impl AddAssign<usize> for Relocatable
Warning: may panic if self.offset + rhs exceeds usize::MAX
impl AddAssign<usize> for Saturating<usize>
impl AddAssign<usize> for cairo_vm::with_std::num::Wrapping<usize>
impl AddAssign<usize> for BigInt
impl AddAssign<usize> for BigUint
impl AddAssign<Duration> for std::time::Instant
impl AddAssign<Duration> for SystemTime
impl AddAssign<Duration> for Date
impl AddAssign<Duration> for time::duration::Duration
impl AddAssign<Duration> for time::instant::Instant
impl AddAssign<Duration> for OffsetDateTime
impl AddAssign<Duration> for PrimitiveDateTime
impl AddAssign<Duration> for Time
impl AddAssign<AffinePoint> for starknet_types_core::curve::projective_point::ProjectivePoint
impl AddAssign<Duration> for cairo_vm::with_std::time::Duration
impl AddAssign<Duration> for std::time::Instant
impl AddAssign<Duration> for SystemTime
impl AddAssign<Duration> for Date
impl AddAssign<Duration> for time::instant::Instant
impl AddAssign<Duration> for OffsetDateTime
impl AddAssign<Duration> for PrimitiveDateTime
impl AddAssign<Duration> for Time
impl<'a> AddAssign for Cow<'a, str>
impl<'a> AddAssign<&'a str> for Cow<'a, str>
impl<'a> AddAssign<&'a Decimal> for &'a mut Decimal
impl<'a> AddAssign<&'a Decimal> for Decimal
impl<'a> AddAssign<Decimal> for &'a mut Decimal
impl<'a, P> AddAssign<&'a CubicExtField<P>> for CubicExtField<P>where
P: CubicExtConfig,
impl<'a, P> AddAssign<&'a QuadExtField<P>> for QuadExtField<P>where
P: QuadExtConfig,
impl<'a, P> AddAssign<&'a mut CubicExtField<P>> for CubicExtField<P>where
P: CubicExtConfig,
impl<'a, P> AddAssign<&'a mut QuadExtField<P>> for QuadExtField<P>where
P: QuadExtConfig,
impl<'a, P, const N: usize> AddAssign<&'a Fp<P, N>> for Fp<P, N>where
P: FpConfig<N>,
impl<'a, P, const N: usize> AddAssign<&'a mut Fp<P, N>> for Fp<P, N>where
P: FpConfig<N>,
impl<F, L> AddAssign<FieldElement<F>> for lambdaworks_math::field::element::FieldElement<L>where
F: IsSubFieldOf<L>,
L: IsField,
AddAssign operator overloading for field elements