| 1 | use encloserust-analyzer cargo enclose 1.2.1 crate/::encloserust-analyzer cargo enclose 1.2.1 enclose!; |
| 2 | |
| 3 | fn mainrust-analyzer cargo enclose 1.2.1 main().() { |
| 4 | let clone_data = 0; |
| 5 | let add_data = 100; |
| 6 | |
| 7 | my_encloserust-analyzer cargo enclose 1.2.1 my_enclose().(encloserust-analyzer cargo enclose 1.2.1 enclose!!((mut clone_data, add_data) || { |
| 8 | // (mut clone_data, add_data) -> |
| 9 | // let mut clone_data = clone_data.clone(); |
| 10 | // let add_data = add_data.clone(); |
| 11 | |
| 12 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("#0 {:?}", clone_data); |
| 13 | clone_data += add_data; |
| 14 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("#1 {:?}", clone_data); |
| 15 | |
| 16 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(clone_data, 100); |
| 17 | })); |
| 18 | |
| 19 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(clone_data, 0); |
| 20 | } |
| 21 | |
| 22 | #[inline] |
| 23 | fn my_encloserust-analyzer cargo enclose 1.2.1 my_enclose().<F: FnOncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnOnce#() -> R, R>(a: F) -> R { |
| 24 | a() |
| 25 | } |