Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait Tap {
- fn tap<R>(self, f: impl Fn(Self) -> R) -> R
- where
- Self: Sized;
- }
- impl<T: Sized> Tap for T where T: Sized {
- fn tap<R>(self, f: impl Fn(T) -> R) -> R {
- f(self)
- }
- }
- fn main() {
- println!("{:?}", " foo ".trim().tap(Some))
- }
Add Comment
Please, Sign In to add comment