Trait Tap
Source pub trait Tap {
// Provided method
fn tap<F>(self, f: F) -> Self
where Self: Sized,
F: Fn(&Self) { ... }
}
Expand description
Adds chaining methods tap to every type.
Applies f to the value for its side effects, and returns the original value.
§Examples
use chaining::*;
let xs = &[1, 2, 3].tap(|xs| println!("debug {}", xs.len()));
assert_eq!(&[1, 2, 3], xs);