2 stable releases
1.0.1 | Sep 10, 2024 |
---|
#3 in #returning
3KB
Pat
A Rust trait for performing operations on a value while returning the value itself, enabling fluent and chainable APIs.
Usage
use pat::Tap;
let result = 5
.tap(|x| *x += 1)
.tap(|x| *x *= 2);
assert_eq!(result, 12);
Features
- Universal implementation for all types
- Chainable operations
- Preserves original type