yui_core/traits/
clone_and.rs1pub trait CloneAnd where Self: Clone {
2 fn clone_and<F>(&self, f: F) -> Self
3 where F: FnOnce(&mut Self) {
4 let mut cloned = self.clone();
5 f(&mut cloned);
6 cloned
7 }
8}
9
10impl<T> CloneAnd for T where T: Clone {}