| Crates.io | scopefn |
| lib.rs | scopefn |
| version | 0.0.2 |
| created_at | 2024-06-02 06:19:21.44769+00 |
| updated_at | 2024-06-02 07:08:16.426273+00 |
| description | Scope functions for Rust |
| homepage | |
| repository | https://github.com/lzt1008/scopefn |
| max_upload_size | |
| id | 1259026 |
| size | 9,079 |
scopefn scopefn is a Rust crate that provides scope functions which inspired by Kotlin's scope functions. It allows you to write more concise and expressive code by providing a set of functions that operate on a value within a specific scope.
fn with_debug(data: Vec<i32>) -> Vec<i32> {
data
.apply(|d| debug!(d))
.do_what_you_want()
.apply(|d| debug!(d))
}
fn sort_them(data: Vec<i32>) -> Vec<i32> {
data.apply_mut(|d| d.sort())
}