apply_conditionally

Crates.ioapply_conditionally
lib.rsapply_conditionally
version2.0.0
sourcesrc
created_at2024-03-07 10:36:44.504479
updated_at2024-04-16 07:55:03.990199
descriptionChain and apply methods on objects conditionally.
homepage
repositoryhttps://github.com/SFM61319/apply_conditionally
max_upload_size
id1165819
size11,431
Avinash Maddikonda (SFM61319)

documentation

README

Apply Conditionally

Chain and apply methods on objects conditionally.

Installation

  1. Using cargo:
cargo add apply_conditionally
  1. By updating Cargo.toml:
[dependencies]
apply_conditionally = "1.0.0"

Usage

// 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();
}

License

Licensed under the MIT License.

Commit count: 15

cargo fmt