pub enum Weight<T>{
Unit(T),
Infinity,
NaN,
}Expand description
Generic implementation of weight with any units that implement std::ops::Add and
std::ops::Sub. This type wraps the unit in a system with an infinity point and a
“not a number” point used by the algorithms.
Implements WeightUnit and Zero.
§Example
use core_cbc_casper::util::weight::Weight::{self, *};
assert_eq!(Unit(2), Unit(1) + Unit(1));
assert_eq!(Infinity, Unit(1) + Infinity);
assert_eq!(Weight::<u32>::NaN.to_string(), (Unit(1) + NaN).to_string());Variants§
Trait Implementations§
Source§impl<T> AddAssign for Weight<T>
impl<T> AddAssign for Weight<T>
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+= operation. Read moreSource§impl<T> PartialOrd for Weight<T>
impl<T> PartialOrd for Weight<T>
Source§impl<T> SubAssign for Weight<T>
impl<T> SubAssign for Weight<T>
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the
-= operation. Read moreSource§impl<T> WeightUnit for Weight<T>
impl<T> WeightUnit for Weight<T>
impl<T> Copy for Weight<T>
Auto Trait Implementations§
impl<T> Freeze for Weight<T>where
T: Freeze,
impl<T> RefUnwindSafe for Weight<T>where
T: RefUnwindSafe,
impl<T> Send for Weight<T>where
T: Send,
impl<T> Sync for Weight<T>where
T: Sync,
impl<T> Unpin for Weight<T>where
T: Unpin,
impl<T> UnsafeUnpin for Weight<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Weight<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more