pub trait Weight: Clone {
const ZERO: Self;
// Required method
fn checked_add_assign(&mut self, v: &Self) -> Result<(), ()>;
}Expand description
Bounds on a weight
See usage in WeightedIndex.
Required Associated Constants§
Required Methods§
Sourcefn checked_add_assign(&mut self, v: &Self) -> Result<(), ()>
fn checked_add_assign(&mut self, v: &Self) -> Result<(), ()>
Checked addition
Result::Ok: On success,vis added toselfResult::Err: Returns an error whenSelfcannot represent the result ofself + v(i.e. overflow). The value ofselfshould be discarded.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".