Trait With
Source pub trait With {
// Provided method
fn with(self, f: impl Fn(&mut Self)) -> Self
where Self: Sized { ... }
}
Expand description
A trait for mutating a value in place.
This trait is automatically implemented for T.
§Example
ⓘuse ranim::prelude::*;
let mut a = 1;
a = a.with(|x| *x = 2);
assert_eq!(a, 2);
Mutating a value in place