1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/// Copied from `syntax::ptr::P` pub trait Map<T> { /// Transform the inner value, consuming `self` and producing a new `P<T>`. fn map<F>(self, f: F) -> Self where F: FnOnce(T) -> T; } impl<T> Map<T> for Box<T> { fn map<F>(mut self, f: F) -> Self where F: FnOnce(T) -> T, { *self = f(*self); self } }