| Crates.io | apply_conditionally |
| lib.rs | apply_conditionally |
| version | 2.0.0 |
| created_at | 2024-03-07 10:36:44.504479+00 |
| updated_at | 2024-04-16 07:55:03.990199+00 |
| description | Chain and apply methods on objects conditionally. |
| homepage | |
| repository | https://github.com/SFM61319/apply_conditionally |
| max_upload_size | |
| id | 1165819 |
| size | 11,431 |
Chain and apply methods on objects conditionally.
cargo:cargo add apply_conditionally
Cargo.toml:[dependencies]
apply_conditionally = "1.0.0"
// Bring the trait into scope to access the trait methods on objects
use apply_conditionally::ApplyConditionally;
fn foo<T>(value: T, condition: bool) {
value
.apply(bar)
.apply_if(condition, baz)
.some_other_method();
}
Licensed under the MIT License.