| 1 | //! Implementations for types from the `alloc` crate. |
| 2 | |
| 3 | use craterust-analyzer cargo daft 0.1.5 crate/::{Diffablerust-analyzer cargo daft 0.1.5 diffable/Diffable#, Leafrust-analyzer cargo daft 0.1.5 leaf/Leaf#}; |
| 4 | use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::{ |
| 5 | borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::{Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#, ToOwnedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/ToOwned#}, |
| 6 | boxedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/::Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#, |
| 7 | 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#, BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#}, |
| 8 | rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/::Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#, |
| 9 | stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/::Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, |
| 10 | syncrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/::Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#, |
| 11 | vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#, |
| 12 | }; |
| 13 | |
| 14 | leaf_derefrust-analyzer cargo daft 0.1.5 macros/leaf_deref!! { Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# => str } |
| 15 | |
| 16 | impl<T: Diffablerust-analyzer cargo daft 0.1.5 diffable/Diffable# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#> Diffablerust-analyzer cargo daft 0.1.5 diffable/Diffable# for Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<T> { |
| 17 | type Diffrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Box<T>`][Diffable]Diff#<'daft> |
| 18 | = <T as Diffablerust-analyzer cargo daft 0.1.5 diffable/Diffable#>::Diffrust-analyzer cargo daft 0.1.5 diffable/Diffable#Diff#<'daft> |
| 19 | where |
| 20 | T: 'daft; |
| 21 | |
| 22 | fn diffrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Box<T>`][Diffable]diff().<'daft>(&'daft self, other: &'daft Selfrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Box<T>`][Diffable]) -> Selfrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Box<T>`][Diffable]::Diffrust-analyzer cargo daft 0.1.5 diffable/Diffable#Diff#<'daft> { |
| 23 | (*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][Deref]deref().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self).diffrust-analyzer cargo daft 0.1.5 diffable/Diffable#diff().(other) |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | impl<T: Diffablerust-analyzer cargo daft 0.1.5 diffable/Diffable# + ToOwnedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/ToOwned# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#> Diffablerust-analyzer cargo daft 0.1.5 diffable/Diffable# for Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'_, T> { |
| 28 | type Diffrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Cow<'_, T>`][Diffable]Diff#<'daft> |
| 29 | = <T as Diffablerust-analyzer cargo daft 0.1.5 diffable/Diffable#>::Diffrust-analyzer cargo daft 0.1.5 diffable/Diffable#Diff#<'daft> |
| 30 | where |
| 31 | Selfrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Cow<'_, T>`][Diffable]: 'daft; |
| 32 | |
| 33 | fn diffrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Cow<'_, T>`][Diffable]diff().<'daft>(&'daft self, other: &'daft Selfrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Cow<'_, T>`][Diffable]) -> Selfrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Cow<'_, T>`][Diffable]::Diffrust-analyzer cargo daft 0.1.5 diffable/Diffable#Diff#<'daft> { |
| 34 | self.as_refrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, T>`][`AsRef<T>`]as_ref().().diffrust-analyzer cargo daft 0.1.5 diffable/Diffable#diff().(other.as_refrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, T>`][`AsRef<T>`]as_ref().()) |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | impl<T: Diffablerust-analyzer cargo daft 0.1.5 diffable/Diffable# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#> Diffablerust-analyzer cargo daft 0.1.5 diffable/Diffable# for Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<T> { |
| 39 | type Diffrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Arc<T>`][Diffable]Diff#<'daft> |
| 40 | = <T as Diffablerust-analyzer cargo daft 0.1.5 diffable/Diffable#>::Diffrust-analyzer cargo daft 0.1.5 diffable/Diffable#Diff#<'daft> |
| 41 | where |
| 42 | T: 'daft; |
| 43 | |
| 44 | fn diffrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Arc<T>`][Diffable]diff().<'daft>(&'daft self, other: &'daft Selfrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Arc<T>`][Diffable]) -> Selfrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Arc<T>`][Diffable]::Diffrust-analyzer cargo daft 0.1.5 diffable/Diffable#Diff#<'daft> { |
| 45 | (*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Deref]deref().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self).diffrust-analyzer cargo daft 0.1.5 diffable/Diffable#diff().(other) |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | impl<T: Diffablerust-analyzer cargo daft 0.1.5 diffable/Diffable# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#> Diffablerust-analyzer cargo daft 0.1.5 diffable/Diffable# for Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#<T> { |
| 50 | type Diffrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Rc<T>`][Diffable]Diff#<'daft> |
| 51 | = <T as Diffablerust-analyzer cargo daft 0.1.5 diffable/Diffable#>::Diffrust-analyzer cargo daft 0.1.5 diffable/Diffable#Diff#<'daft> |
| 52 | where |
| 53 | T: 'daft; |
| 54 | |
| 55 | fn diffrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Rc<T>`][Diffable]diff().<'daft>(&'daft self, other: &'daft Selfrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Rc<T>`][Diffable]) -> Selfrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Rc<T>`][Diffable]::Diffrust-analyzer cargo daft 0.1.5 diffable/Diffable#Diff#<'daft> { |
| 56 | (*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self).diffrust-analyzer cargo daft 0.1.5 diffable/Diffable#diff().(other) |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | map_diffrust-analyzer cargo daft 0.1.5 macros/map_diff!!( |
| 61 | /// A diff of two [`BTreeMap`] instances. |
| 62 | /// |
| 63 | /// The diff contains three elements: |
| 64 | /// |
| 65 | /// - `common`: Entries that are present in both maps, with their values |
| 66 | /// stored as a [`Leaf`]. |
| 67 | /// - `added`: Entries present in `after`, but not in `before`. |
| 68 | /// - `removed`: Entries present in `before`, but not in `after`. |
| 69 | /// |
| 70 | /// If `V` implements `Eq`, `common` can be split into |
| 71 | /// [`unchanged`][Self::unchanged] and [`modified`][Self::modified] entries. |
| 72 | /// Additionally, if `V` implements [`Diffable`], |
| 73 | /// [`modified_diff`][Self::modified_diff] can be used to recursively diff |
| 74 | /// modified entries. |
| 75 | /// |
| 76 | /// # Example |
| 77 | /// |
| 78 | /// ``` |
| 79 | /// # #[cfg(feature = "std")] { |
| 80 | /// use daft::{BTreeMapDiff, Diffable, Leaf}; |
| 81 | /// use std::collections::BTreeMap; |
| 82 | /// |
| 83 | /// let a: BTreeMap<usize, &str> = |
| 84 | /// [(0, "lorem"), (1, "ipsum"), (2, "dolor")].into_iter().collect(); |
| 85 | /// let b: BTreeMap<usize, &str> = |
| 86 | /// [(1, "ipsum"), (2, "sit"), (3, "amet")].into_iter().collect(); |
| 87 | /// |
| 88 | /// let changes = a.diff(&b); |
| 89 | /// let expected = BTreeMapDiff { |
| 90 | /// // Keys are stored by reference and matched by equality. |
| 91 | /// common: [ |
| 92 | /// (&1, Leaf { before: &"ipsum", after: &"ipsum" }), |
| 93 | /// (&2, Leaf { before: &"dolor", after: &"sit" }), |
| 94 | /// ].into_iter().collect(), |
| 95 | /// added: [(&3, &"amet")].into_iter().collect(), |
| 96 | /// removed: [(&0, &"lorem")].into_iter().collect(), |
| 97 | /// }; |
| 98 | /// |
| 99 | /// assert_eq!(changes, expected); |
| 100 | /// |
| 101 | /// // If the values are `Eq`, it's also possible to get lists of |
| 102 | /// // modified and unchanged entries. |
| 103 | /// assert!(changes.is_unchanged(&1)); |
| 104 | /// assert!(changes.is_modified(&2)); |
| 105 | /// let unchanged = changes.unchanged().collect::<Vec<_>>(); |
| 106 | /// let modified = changes.modified().collect::<Vec<_>>(); |
| 107 | /// |
| 108 | /// assert_eq!(unchanged, [(&1, &"ipsum")]); |
| 109 | /// assert_eq!(modified, [(&2, Leaf { before: &"dolor", after: &"sit" })]); |
| 110 | /// # } |
| 111 | /// ``` |
| 112 | BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# |
| 113 | ); |
| 114 | set_diffrust-analyzer cargo daft 0.1.5 macros/set_diff!!( |
| 115 | /// A diff of two [`BTreeSet`] instances. |
| 116 | /// |
| 117 | /// The diff contains three elements: |
| 118 | /// |
| 119 | /// - `common`: Entries that are present in both sets. |
| 120 | /// - `added`: Entries present in `after`, but not in `before`. |
| 121 | /// - `removed`: Entries present in `before`, but not in `after`. |
| 122 | /// |
| 123 | /// # Example |
| 124 | /// |
| 125 | /// ``` |
| 126 | /// # #[cfg(feature = "std")] { |
| 127 | /// use daft::{BTreeSetDiff, Diffable}; |
| 128 | /// use std::collections::BTreeSet; |
| 129 | /// |
| 130 | /// let a: BTreeSet<usize> = [0, 1].into_iter().collect(); |
| 131 | /// let b: BTreeSet<usize> = [1, 2].into_iter().collect(); |
| 132 | /// |
| 133 | /// let changes = a.diff(&b); |
| 134 | /// let expected = BTreeSetDiff { |
| 135 | /// // Entries are stored by reference and matched by equality. |
| 136 | /// common: [&1].into_iter().collect(), |
| 137 | /// added: [&2].into_iter().collect(), |
| 138 | /// removed: [&0].into_iter().collect(), |
| 139 | /// }; |
| 140 | /// |
| 141 | /// assert_eq!(changes, expected); |
| 142 | /// # } |
| 143 | /// ``` |
| 144 | BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# |
| 145 | ); |
| 146 | |
| 147 | /// Treat Vecs as Leafs |
| 148 | // |
| 149 | // We plan to add opt in diff functionality: set-like, reordered, etc... |
| 150 | impl<T: Diffablerust-analyzer cargo daft 0.1.5 diffable/Diffable#> Diffablerust-analyzer cargo daft 0.1.5 diffable/Diffable# for Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<T> { |
| 151 | type Diffrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Vec<T>`][Diffable]Diff#<'daft> |
| 152 | = Leafrust-analyzer cargo daft 0.1.5 leaf/Leaf#<&'daft [T]> |
| 153 | where |
| 154 | T: 'daft; |
| 155 | |
| 156 | fn diffrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Vec<T>`][Diffable]diff().<'daft>(&'daft self, other: &'daft Selfrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Vec<T>`][Diffable]) -> Selfrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`Vec<T>`][Diffable]::Diffrust-analyzer cargo daft 0.1.5 diffable/Diffable#Diff#<'daft> { |
| 157 | Leafrust-analyzer cargo daft 0.1.5 leaf/Leaf# { beforerust-analyzer cargo daft 0.1.5 leaf/Leaf#before.: self, afterrust-analyzer cargo daft 0.1.5 leaf/Leaf#after.: other } |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | #[cfg(test)] |
| 162 | mod testsrust-analyzer cargo daft 0.1.5 alloc_impls/tests/ { |
| 163 | use superrust-analyzer cargo daft 0.1.5 alloc_impls/::*; |
| 164 | |
| 165 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 166 | fn btree_set_diffrust-analyzer cargo daft 0.1.5 alloc_impls/tests/btree_set_diff().() { |
| 167 | let a: BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#<_> = [0, 1, 2, 3, 4, 5].into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 168 | let b: BTreeSetrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/set/BTreeSet#<_> = [3, 4, 5, 6, 7, 8].into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 169 | let changes = a.diffrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`BTreeSet<K>`][Diffable]diff().(&b); |
| 170 | let expected = BTreeSetDiffrust-analyzer cargo daft 0.1.5 alloc_impls/BTreeSetDiff# { |
| 171 | addedrust-analyzer cargo daft 0.1.5 alloc_impls/BTreeSetDiff#added.: [&6, &7, &8].into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 172 | removedrust-analyzer cargo daft 0.1.5 alloc_impls/BTreeSetDiff#removed.: [&0, &1, &2].into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 173 | commonrust-analyzer cargo daft 0.1.5 alloc_impls/BTreeSetDiff#common.: [&3, &4, &5].into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 174 | }; |
| 175 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, changes); |
| 176 | } |
| 177 | |
| 178 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 179 | fn btree_map_diffrust-analyzer cargo daft 0.1.5 alloc_impls/tests/btree_map_diff().() { |
| 180 | let a: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<_, _> = [(0, 1), (1, 1), (2, 1)].into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 181 | let b: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<_, _> = [(0, 2), (2, 1), (3, 1)].into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 182 | |
| 183 | let changes = a.diffrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`BTreeMap<K, V>`][Diffable]diff().(&b); |
| 184 | let expected = BTreeMapDiffrust-analyzer cargo daft 0.1.5 alloc_impls/BTreeMapDiff# { |
| 185 | commonrust-analyzer cargo daft 0.1.5 alloc_impls/BTreeMapDiff#common.: [ |
| 186 | (&0, Leafrust-analyzer cargo daft 0.1.5 leaf/Leaf# { beforerust-analyzer cargo daft 0.1.5 leaf/Leaf#before.: &1, afterrust-analyzer cargo daft 0.1.5 leaf/Leaf#after.: &2 }), |
| 187 | (&2, Leafrust-analyzer cargo daft 0.1.5 leaf/Leaf# { beforerust-analyzer cargo daft 0.1.5 leaf/Leaf#before.: &1, afterrust-analyzer cargo daft 0.1.5 leaf/Leaf#after.: &1 }), |
| 188 | ] |
| 189 | .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().() |
| 190 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 191 | addedrust-analyzer cargo daft 0.1.5 alloc_impls/BTreeMapDiff#added.: [(&3, &1)].into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 192 | removedrust-analyzer cargo daft 0.1.5 alloc_impls/BTreeMapDiff#removed.: [(&1, &1)].into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(), |
| 193 | }; |
| 194 | |
| 195 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(changes, expected); |
| 196 | |
| 197 | // Ensure that keys don't need to be Diffable, and values don't need to |
| 198 | // be Eq or Diffable. |
| 199 | #[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:, 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:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:)] |
| 200 | struct Krust-analyzer cargo daft 0.1.5 alloc_impls/tests/K#(i32); |
| 201 | |
| 202 | #[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:)] |
| 203 | #[expect(dead_code)] |
| 204 | struct Vrust-analyzer cargo daft 0.1.5 alloc_impls/tests/V#(f64); |
| 205 | |
| 206 | let floats_a: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Krust-analyzer cargo daft 0.1.5 alloc_impls/tests/K#, Vrust-analyzer cargo daft 0.1.5 alloc_impls/tests/V#> = |
| 207 | [(Krust-analyzer cargo daft 0.1.5 alloc_impls/tests/K#(0), Vrust-analyzer cargo daft 0.1.5 alloc_impls/tests/V#(1.0)), (Krust-analyzer cargo daft 0.1.5 alloc_impls/tests/K#(1), Vrust-analyzer cargo daft 0.1.5 alloc_impls/tests/V#(1.0)), (Krust-analyzer cargo daft 0.1.5 alloc_impls/tests/K#(2), Vrust-analyzer cargo daft 0.1.5 alloc_impls/tests/V#(1.0))] |
| 208 | .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().() |
| 209 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 210 | let floats_b: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Krust-analyzer cargo daft 0.1.5 alloc_impls/tests/K#, Vrust-analyzer cargo daft 0.1.5 alloc_impls/tests/V#> = |
| 211 | [(Krust-analyzer cargo daft 0.1.5 alloc_impls/tests/K#(0), Vrust-analyzer cargo daft 0.1.5 alloc_impls/tests/V#(2.0)), (Krust-analyzer cargo daft 0.1.5 alloc_impls/tests/K#(2), Vrust-analyzer cargo daft 0.1.5 alloc_impls/tests/V#(1.0)), (Krust-analyzer cargo daft 0.1.5 alloc_impls/tests/K#(3), Vrust-analyzer cargo daft 0.1.5 alloc_impls/tests/V#(1.0))] |
| 212 | .into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().() |
| 213 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 214 | |
| 215 | let diff = floats_a.diffrust-analyzer cargo daft 0.1.5 alloc_impls/impl#[`BTreeMap<K, V>`][Diffable]diff().(&floats_b); |
| 216 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(diff.addedrust-analyzer cargo daft 0.1.5 alloc_impls/BTreeMapDiff#added..keysrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]keys().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), [&Krust-analyzer cargo daft 0.1.5 alloc_impls/tests/K#(3)]); |
| 217 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(diff.removedrust-analyzer cargo daft 0.1.5 alloc_impls/BTreeMapDiff#removed..keysrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]keys().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), [&Krust-analyzer cargo daft 0.1.5 alloc_impls/tests/K#(1)]); |
| 218 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 219 | diff.commonrust-analyzer cargo daft 0.1.5 alloc_impls/BTreeMapDiff#common..keysrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]keys().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(), |
| 220 | [&Krust-analyzer cargo daft 0.1.5 alloc_impls/tests/K#(0), &Krust-analyzer cargo daft 0.1.5 alloc_impls/tests/K#(2)] |
| 221 | ); |
| 222 | } |
| 223 | } |