pub struct Sum<T>(pub T);
Expand description
Semigroup of the Sum of type T if type T implements std::ops::Add.
let five = Sum(5);
let ten = Sum(10);
assert_eq!(Sum(15), five.combine(ten));
Tuple Fields§
§0: T
Trait Implementations§
Source§impl<T: Ord> Ord for Sum<T>
impl<T: Ord> Ord for Sum<T>
Source§impl<T: PartialOrd> PartialOrd<T> for Sum<T>
impl<T: PartialOrd> PartialOrd<T> for Sum<T>
Source§impl<T: PartialOrd> PartialOrd for Sum<T>
impl<T: PartialOrd> PartialOrd for Sum<T>
impl<T: Copy> Copy for Sum<T>
impl<T: Eq> Eq for Sum<T>
impl<T> StructuralPartialEq for Sum<T>
Auto Trait Implementations§
impl<T> Freeze for Sum<T>where
T: Freeze,
impl<T> RefUnwindSafe for Sum<T>where
T: RefUnwindSafe,
impl<T> Send for Sum<T>where
T: Send,
impl<T> Sync for Sum<T>where
T: Sync,
impl<T> Unpin for Sum<T>where
T: Unpin,
impl<T> UnwindSafe for Sum<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