1 2 3 4 5 6 7 8 9 10 11
/// Generic trait to enable chainable API pub trait With: Sized { /// Calls the given closure on `self`. fn with<F: FnOnce(&mut Self)>(mut self, f: F) -> Self { f(&mut self); self } } impl<T: Sized> With for T {}