| 1 | leafrust-analyzer cargo daft 0.1.5 macros/leaf!! { uuidrust-analyzer cargo uuid 1.12.1 crate/::Uuidrust-analyzer cargo uuid 1.12.1 Uuid# } |
| 2 | |
| 3 | #[cfg(test)] |
| 4 | #[cfg(feature = "alloc")] |
| 5 | mod testsrust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/ { |
| 6 | use craterust-analyzer cargo daft 0.1.5 crate/::{BTreeMapDiffrust-analyzer cargo daft 0.1.5 alloc_impls/BTreeMapDiff#, Diffablerust-analyzer cargo daft 0.1.5 diffable/Diffable#, Leafrust-analyzer cargo daft 0.1.5 leaf/Leaf#}; |
| 7 | use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::{collectionsrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/::BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/}; |
| 8 | |
| 9 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 10 | fn example_structrust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/example_struct().() { |
| 11 | use uuidrust-analyzer cargo uuid 1.12.1 crate/::Uuidrust-analyzer cargo uuid 1.12.1 Uuid#; |
| 12 | |
| 13 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 14 | enum SledStaterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/SledState# { |
| 15 | Activerust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/SledState#Active#, |
| 16 | Decommissionedrust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/SledState#Decommissioned#, |
| 17 | } |
| 18 | leafrust-analyzer cargo daft 0.1.5 macros/leaf!!(SledStaterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/SledState#); |
| 19 | |
| 20 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 21 | struct TestStructrust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStruct# { |
| 22 | idrust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStruct#id.: Uuidrust-analyzer cargo uuid 1.12.1 Uuid#, |
| 23 | sled_staterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStruct#sled_state.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Uuidrust-analyzer cargo uuid 1.12.1 Uuid#, SledStaterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/SledState#>, |
| 24 | } |
| 25 | |
| 26 | // This is what daft-derive should generate |
| 27 | // for `TestStruct` |
| 28 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 29 | struct TestStructDiffrust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStructDiff#<'daft> { |
| 30 | idrust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStructDiff#id.: Leafrust-analyzer cargo daft 0.1.5 leaf/Leaf#<&'daft Uuidrust-analyzer cargo uuid 1.12.1 Uuid#>, |
| 31 | sled_staterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStructDiff#sled_state.: BTreeMapDiffrust-analyzer cargo daft 0.1.5 alloc_impls/BTreeMapDiff#<'daft, Uuidrust-analyzer cargo uuid 1.12.1 Uuid#, SledStaterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/SledState#>, |
| 32 | } |
| 33 | |
| 34 | let sled_states = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 35 | (Uuidrust-analyzer cargo uuid 1.12.1 Uuid#::new_v4rust-analyzer cargo uuid 1.12.1 v4/impl#[Uuid]new_v4().(), SledStaterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/SledState#::Activerust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/SledState#Active#), |
| 36 | (Uuidrust-analyzer cargo uuid 1.12.1 Uuid#::new_v4rust-analyzer cargo uuid 1.12.1 v4/impl#[Uuid]new_v4().(), SledStaterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/SledState#::Activerust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/SledState#Active#), |
| 37 | (Uuidrust-analyzer cargo uuid 1.12.1 Uuid#::new_v4rust-analyzer cargo uuid 1.12.1 v4/impl#[Uuid]new_v4().(), SledStaterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/SledState#::Decommissionedrust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/SledState#Decommissioned#), |
| 38 | ]; |
| 39 | |
| 40 | let a = TestStructrust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStruct# { |
| 41 | idrust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStruct#id.: Uuidrust-analyzer cargo uuid 1.12.1 Uuid#::new_v4rust-analyzer cargo uuid 1.12.1 v4/impl#[Uuid]new_v4().(), |
| 42 | sled_staterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStruct#sled_state.: sled_states.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().().into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 43 | }; |
| 44 | let mut b = a.clonerust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/impl#[TestStruct][Clone]clone().(); |
| 45 | b.idrust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStruct#id. = Uuidrust-analyzer cargo uuid 1.12.1 Uuid#::new_v4rust-analyzer cargo uuid 1.12.1 v4/impl#[Uuid]new_v4().(); |
| 46 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().(b.sled_staterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStruct#sled_state..get_mutrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get_mut().(&sled_states[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..0).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()) = |
| 47 | SledStaterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/SledState#::Decommissionedrust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/SledState#Decommissioned#; |
| 48 | b.sled_staterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStruct#sled_state..insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().(Uuidrust-analyzer cargo uuid 1.12.1 Uuid#::new_v4rust-analyzer cargo uuid 1.12.1 v4/impl#[Uuid]new_v4().(), SledStaterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/SledState#::Activerust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/SledState#Active#); |
| 49 | |
| 50 | let diff = TestStructDiffrust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStructDiff# { |
| 51 | idrust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStructDiff#id.: a.idrust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStruct#id..diffrust-analyzer cargo daft 0.1.5 third_party/uuid_impls/impl#[`uuid::Uuid`][Diffable]diff().(&b.idrust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStruct#id.), |
| 52 | sled_staterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStructDiff#sled_state.: a.sled_staterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStruct#sled_state..diffrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`BTreeMap<K, V>`][Diffable]diff().(&b.sled_staterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStruct#sled_state.), |
| 53 | }; |
| 54 | |
| 55 | assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!(diff.idrust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStructDiff#id..beforerust-analyzer cargo daft 0.1.5 leaf/Leaf#before., diff.idrust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStructDiff#id..afterrust-analyzer cargo daft 0.1.5 leaf/Leaf#after.); |
| 56 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(diff.sled_staterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStructDiff#sled_state..unchangedrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`BTreeMapDiff<'daft, K, V>`]unchanged().().countrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#count().(), 2); |
| 57 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(diff.sled_staterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStructDiff#sled_state..addedrust-analyzer cargo daft 0.1.5 alloc_impls/BTreeMapDiff#added..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]len().(), 1); |
| 58 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(diff.sled_staterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStructDiff#sled_state..removedrust-analyzer cargo daft 0.1.5 alloc_impls/BTreeMapDiff#removed..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]len().(), 0); |
| 59 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(diff.sled_staterust-analyzer cargo daft 0.1.5 third_party/uuid_impls/tests/TestStructDiff#sled_state..modifiedrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`BTreeMapDiff<'daft, K, V>`]modified().().countrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#count().(), 1); |
| 60 | } |
| 61 | } |