| 1 | use encloserust-analyzer cargo enclose 1.2.1 crate/::encloserust-analyzer cargo enclose 1.2.1 enclose!; |
| 2 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#; |
| 3 | |
| 4 | fn mainrust-analyzer cargo enclose 1.2.1 main().() { |
| 5 | let clone_data = Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T>`]new().(0); |
| 6 | let add_data = Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T>`]new().(100); |
| 7 | |
| 8 | my_encloserust-analyzer cargo enclose 1.2.1 my_enclose().(encloserust-analyzer cargo enclose 1.2.1 enclose!!((mut *clone_data, *add_data,) || { |
| 9 | // (mut *clone_data, *add_data) -> |
| 10 | // let mut clone_data = *clone_data; |
| 11 | // let add_data = *add_data; |
| 12 | |
| 13 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("#0 {:?}", clone_data); |
| 14 | clone_data += add_data; |
| 15 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("#1 {:?}", clone_data); |
| 16 | |
| 17 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(clone_data, 100); |
| 18 | })); |
| 19 | |
| 20 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Deref]deref().clone_data, 0); |
| 21 | } |
| 22 | |
| 23 | #[inline] |
| 24 | 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 { |
| 25 | a() |
| 26 | } |