-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2. Update package description 3. Bump package version to `1.2.0` 4. Refactor `readme.md` 5. Rename some examples 6. Remove `run_enc`, `run_enclose` macros, [] is easier to type than `enclose()` for small tests 7. Document many macros 8. Allow trailing comma in `enc`, `enclose` macro 9. Update tests 10. Simplify `enc`, `enclose`, `enclose_var` macros
- Loading branch information
1 parent
0264d4c
commit 1a78797
Showing
31 changed files
with
804 additions
and
1,180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*.rs] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = false | ||
insert_final_newline = false | ||
indent_style = tab | ||
indent_size = 5 | ||
max_line_length = 80 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use enclose::enclose; | ||
use std::sync::Arc; | ||
|
||
fn main() { | ||
let clone_data = Arc::new(0); | ||
let add_data = Arc::new(100); | ||
|
||
// I also note that any expressions can be used, but the main thing is to | ||
// put the @ symbol at the beginning of the variable, and not forget to assign | ||
// a new name to the variable using =>. | ||
my_enclose( | ||
enclose!((@*clone_data => mut clone_data: usize, @*(add_data.clone()) => add_data) || { | ||
// (@*clone_data => mut clone_data, @*(add_data.clone()) => add_data) -> | ||
// let mut clone_data = *clone_data; | ||
// let add_data = *(add_data.clone()); | ||
|
||
println!("#0 {:?}", clone_data); | ||
clone_data += add_data; | ||
println!("#1 {:?}", clone_data); | ||
|
||
assert_eq!(clone_data, 100); | ||
}), | ||
); | ||
|
||
assert_eq!(*clone_data, 0); | ||
} | ||
|
||
#[inline] | ||
fn my_enclose<F: FnOnce() -> R, R>(a: F) -> R { | ||
a() | ||
} |
Oops, something went wrong.