| 1 | //! A bimap backed by two `BTreeMap`s. |
| 2 | |
| 3 | use craterust-analyzer cargo bimap 0.6.3 crate/::{ |
| 4 | memrust-analyzer cargo bimap 0.6.3 mem/::{Refrust-analyzer cargo bimap 0.6.3 mem/Ref#, Wrapperrust-analyzer cargo bimap 0.6.3 mem/Wrapper#}, |
| 5 | Overwrittenrust-analyzer cargo bimap 0.6.3 Overwritten#, |
| 6 | }; |
| 7 | use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::{ |
| 8 | collectionsrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/::{btree_maprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree_map/, BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#}, |
| 9 | 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#, |
| 10 | }; |
| 11 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::{ |
| 12 | borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/::Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#, |
| 13 | cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#, |
| 14 | fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/, |
| 15 | hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/::{Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#, Hasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hasher#}, |
| 16 | iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::{Extendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/Extend#, FromIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/FromIterator#, FusedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/marker/FusedIterator#}, |
| 17 | opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::RangeBoundsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeBounds#, |
| 18 | }; |
| 19 | |
| 20 | /// A bimap backed by two `BTreeMap`s. |
| 21 | /// |
| 22 | /// See the [module-level documentation] for more details and examples. |
| 23 | /// |
| 24 | /// [module-level documentation]: crate |
| 25 | pub struct BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#<L, R> { |
| 26 | left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<L>, Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<R>>, |
| 27 | right2leftrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#right2left.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#<Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<R>, Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<L>>, |
| 28 | } |
| 29 | |
| 30 | impl<L, R> BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#<L, R> |
| 31 | where |
| 32 | L: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 33 | R: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 34 | { |
| 35 | /// Creates an empty `BiBTreeMap`. |
| 36 | /// |
| 37 | /// # Examples |
| 38 | /// |
| 39 | /// ``` |
| 40 | /// use bimap::BiBTreeMap; |
| 41 | /// |
| 42 | /// let bimap = BiBTreeMap::<char, i32>::new(); |
| 43 | /// ``` |
| 44 | pub fn newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().() -> Selfrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`] { |
| 45 | Selfrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`] { |
| 46 | left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`]new().(), |
| 47 | right2leftrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#right2left.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`]new().(), |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | /// Returns the number of left-right pairs in the bimap. |
| 52 | /// |
| 53 | /// # Examples |
| 54 | /// |
| 55 | /// ``` |
| 56 | /// use bimap::BiBTreeMap; |
| 57 | /// |
| 58 | /// let mut bimap = BiBTreeMap::new(); |
| 59 | /// bimap.insert('a', 1); |
| 60 | /// bimap.insert('b', 2); |
| 61 | /// bimap.insert('c', 3); |
| 62 | /// assert_eq!(bimap.len(), 3); |
| 63 | /// ``` |
| 64 | pub fn lenrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]len().(&self) -> usize { |
| 65 | self.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right..lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]len().() |
| 66 | } |
| 67 | |
| 68 | /// Returns `true` if the bimap contains no left-right pairs, and `false` |
| 69 | /// otherwise. |
| 70 | /// |
| 71 | /// # Examples |
| 72 | /// |
| 73 | /// ``` |
| 74 | /// use bimap::BiBTreeMap; |
| 75 | /// |
| 76 | /// let mut bimap = BiBTreeMap::new(); |
| 77 | /// assert!(bimap.is_empty()); |
| 78 | /// bimap.insert('a', 1); |
| 79 | /// assert!(!bimap.is_empty()); |
| 80 | /// bimap.remove_by_right(&1); |
| 81 | /// assert!(bimap.is_empty()); |
| 82 | /// ``` |
| 83 | pub fn is_emptyrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]is_empty().(&self) -> bool { |
| 84 | self.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]is_empty().() |
| 85 | } |
| 86 | |
| 87 | /// Removes all left-right pairs from the bimap. |
| 88 | /// |
| 89 | /// # Examples |
| 90 | /// |
| 91 | /// ``` |
| 92 | /// use bimap::BiBTreeMap; |
| 93 | /// |
| 94 | /// let mut bimap = BiBTreeMap::new(); |
| 95 | /// bimap.insert('a', 1); |
| 96 | /// bimap.insert('b', 2); |
| 97 | /// bimap.insert('c', 3); |
| 98 | /// bimap.clear(); |
| 99 | /// assert!(bimap.len() == 0); |
| 100 | /// ``` |
| 101 | pub fn clearrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]clear().(&mut self) { |
| 102 | self.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right..clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]clear().(); |
| 103 | self.right2leftrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#right2left..clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]clear().(); |
| 104 | } |
| 105 | |
| 106 | /// Creates an iterator over the left-right pairs in the bimap in ascending |
| 107 | /// order by left value. |
| 108 | /// |
| 109 | /// The iterator element type is `(&L, &R)`. |
| 110 | /// |
| 111 | /// # Examples |
| 112 | /// |
| 113 | /// ``` |
| 114 | /// use bimap::BiBTreeMap; |
| 115 | /// |
| 116 | /// let mut bimap = BiBTreeMap::new(); |
| 117 | /// bimap.insert('a', 1); |
| 118 | /// bimap.insert('b', 2); |
| 119 | /// bimap.insert('c', 3); |
| 120 | /// |
| 121 | /// for (left, right) in bimap.iter() { |
| 122 | /// println!("({}, {})", left, right); |
| 123 | /// } |
| 124 | /// ``` |
| 125 | pub fn iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]iter().(&self) -> Iterrust-analyzer cargo bimap 0.6.3 btree/Iter#<'_, L, R> { |
| 126 | Iterrust-analyzer cargo bimap 0.6.3 btree/Iter# { |
| 127 | innerrust-analyzer cargo bimap 0.6.3 btree/Iter#inner.: self.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]iter().(), |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | /// Creates an iterator over the left values in the bimap in ascending |
| 132 | /// order. |
| 133 | /// |
| 134 | /// The iterator element type is `&L`. |
| 135 | /// |
| 136 | /// # Examples |
| 137 | /// |
| 138 | /// ``` |
| 139 | /// use bimap::BiBTreeMap; |
| 140 | /// |
| 141 | /// let mut bimap = BiBTreeMap::new(); |
| 142 | /// bimap.insert('a', 1); |
| 143 | /// bimap.insert('b', 2); |
| 144 | /// bimap.insert('c', 3); |
| 145 | /// |
| 146 | /// for char_value in bimap.left_values() { |
| 147 | /// println!("{}", char_value); |
| 148 | /// } |
| 149 | /// ``` |
| 150 | pub fn left_valuesrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]left_values().(&self) -> LeftValuesrust-analyzer cargo bimap 0.6.3 btree/LeftValues#<'_, L, R> { |
| 151 | LeftValuesrust-analyzer cargo bimap 0.6.3 btree/LeftValues# { |
| 152 | innerrust-analyzer cargo bimap 0.6.3 btree/LeftValues#inner.: self.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]iter().(), |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | /// Creates an iterator over the right values in the bimap in ascending |
| 157 | /// order. |
| 158 | /// |
| 159 | /// The iterator element type is `&R`. |
| 160 | /// |
| 161 | /// # Examples |
| 162 | /// |
| 163 | /// ``` |
| 164 | /// use bimap::BiBTreeMap; |
| 165 | /// |
| 166 | /// let mut bimap = BiBTreeMap::new(); |
| 167 | /// bimap.insert('a', 1); |
| 168 | /// bimap.insert('b', 2); |
| 169 | /// bimap.insert('c', 3); |
| 170 | /// |
| 171 | /// for int_value in bimap.right_values() { |
| 172 | /// println!("{}", int_value); |
| 173 | /// } |
| 174 | /// ``` |
| 175 | pub fn right_valuesrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]right_values().(&self) -> RightValuesrust-analyzer cargo bimap 0.6.3 btree/RightValues#<'_, L, R> { |
| 176 | RightValuesrust-analyzer cargo bimap 0.6.3 btree/RightValues# { |
| 177 | innerrust-analyzer cargo bimap 0.6.3 btree/RightValues#inner.: self.right2leftrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#right2left..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]iter().(), |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | /// Returns a reference to the right value corresponding to the given left |
| 182 | /// value. |
| 183 | /// |
| 184 | /// The input may be any borrowed form of the bimap's left type, but the |
| 185 | /// ordering on the borrowed form *must* match the ordering on the left |
| 186 | /// type. |
| 187 | /// |
| 188 | /// # Examples |
| 189 | /// |
| 190 | /// ``` |
| 191 | /// use bimap::BiBTreeMap; |
| 192 | /// |
| 193 | /// let mut bimap = BiBTreeMap::new(); |
| 194 | /// bimap.insert('a', 1); |
| 195 | /// assert_eq!(bimap.get_by_left(&'a'), Some(&1)); |
| 196 | /// assert_eq!(bimap.get_by_left(&'z'), None); |
| 197 | /// ``` |
| 198 | pub fn get_by_leftrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]get_by_left().<Q>(&self, left: &Q) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&R> |
| 199 | where |
| 200 | L: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Q>, |
| 201 | Q: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 202 | { |
| 203 | self.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right..getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().(Wrapperrust-analyzer cargo bimap 0.6.3 mem/Wrapper#::wraprust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`]wrap().(left)).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|l| &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().l.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.) |
| 204 | } |
| 205 | |
| 206 | /// Returns a reference to the left value corresponding to the given right |
| 207 | /// value. |
| 208 | /// |
| 209 | /// The input may be any borrowed form of the bimap's right type, but the |
| 210 | /// ordering on the borrowed form *must* match the ordering on the right |
| 211 | /// type. |
| 212 | /// |
| 213 | /// # Examples |
| 214 | /// |
| 215 | /// ``` |
| 216 | /// use bimap::BiBTreeMap; |
| 217 | /// |
| 218 | /// let mut bimap = BiBTreeMap::new(); |
| 219 | /// bimap.insert('a', 1); |
| 220 | /// assert_eq!(bimap.get_by_right(&1), Some(&'a')); |
| 221 | /// assert_eq!(bimap.get_by_right(&2), None); |
| 222 | /// ``` |
| 223 | pub fn get_by_rightrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]get_by_right().<Q>(&self, right: &Q) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&L> |
| 224 | where |
| 225 | R: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Q>, |
| 226 | Q: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 227 | { |
| 228 | self.right2leftrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#right2left..getrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]get().(Wrapperrust-analyzer cargo bimap 0.6.3 mem/Wrapper#::wraprust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`]wrap().(right)).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|r| &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().r.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.) |
| 229 | } |
| 230 | |
| 231 | /// Returns `true` if the bimap contains the given left value and `false` |
| 232 | /// otherwise. |
| 233 | /// |
| 234 | /// The input may be any borrowed form of the bimap's left type, but the |
| 235 | /// ordering on the borrowed form *must* match the ordering on the left |
| 236 | /// type. |
| 237 | /// |
| 238 | /// # Examples |
| 239 | /// |
| 240 | /// ``` |
| 241 | /// use bimap::BiBTreeMap; |
| 242 | /// |
| 243 | /// let mut bimap = BiBTreeMap::new(); |
| 244 | /// bimap.insert('a', 1); |
| 245 | /// assert!(bimap.contains_left(&'a')); |
| 246 | /// assert!(!bimap.contains_left(&'b')); |
| 247 | /// ``` |
| 248 | pub fn contains_leftrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]contains_left().<Q>(&self, left: &Q) -> bool |
| 249 | where |
| 250 | L: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Q>, |
| 251 | Q: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 252 | { |
| 253 | self.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right..contains_keyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]contains_key().(Wrapperrust-analyzer cargo bimap 0.6.3 mem/Wrapper#::wraprust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`]wrap().(left)) |
| 254 | } |
| 255 | |
| 256 | /// Returns `true` if the map contains the given right value and `false` |
| 257 | /// otherwise. |
| 258 | /// |
| 259 | /// The input may be any borrowed form of the bimap's right type, but the |
| 260 | /// ordering on the borrowed form *must* match the ordering on the right |
| 261 | /// type. |
| 262 | /// |
| 263 | /// # Examples |
| 264 | /// |
| 265 | /// ``` |
| 266 | /// use bimap::BiBTreeMap; |
| 267 | /// |
| 268 | /// let mut bimap = BiBTreeMap::new(); |
| 269 | /// bimap.insert('a', 1); |
| 270 | /// assert!(bimap.contains_right(&1)); |
| 271 | /// assert!(!bimap.contains_right(&2)); |
| 272 | /// ``` |
| 273 | pub fn contains_rightrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]contains_right().<Q>(&self, right: &Q) -> bool |
| 274 | where |
| 275 | R: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Q>, |
| 276 | Q: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 277 | { |
| 278 | self.right2leftrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#right2left..contains_keyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]contains_key().(Wrapperrust-analyzer cargo bimap 0.6.3 mem/Wrapper#::wraprust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`]wrap().(right)) |
| 279 | } |
| 280 | |
| 281 | /// Removes the left-right pair corresponding to the given left value. |
| 282 | /// |
| 283 | /// Returns the previous left-right pair if the map contained the left value |
| 284 | /// and `None` otherwise. |
| 285 | /// |
| 286 | /// The input may be any borrowed form of the bimap's left type, but the |
| 287 | /// ordering on the borrowed form *must* match the ordering on the left |
| 288 | /// type. |
| 289 | /// |
| 290 | /// # Examples |
| 291 | /// |
| 292 | /// ``` |
| 293 | /// use bimap::BiBTreeMap; |
| 294 | /// |
| 295 | /// let mut bimap = BiBTreeMap::new(); |
| 296 | /// bimap.insert('a', 1); |
| 297 | /// bimap.insert('b', 2); |
| 298 | /// bimap.insert('c', 3); |
| 299 | /// |
| 300 | /// assert_eq!(bimap.remove_by_left(&'b'), Some(('b', 2))); |
| 301 | /// assert_eq!(bimap.remove_by_left(&'b'), None); |
| 302 | /// ``` |
| 303 | pub fn remove_by_leftrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]remove_by_left().<Q>(&mut self, left: &Q) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(L, R)> |
| 304 | where |
| 305 | L: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Q>, |
| 306 | Q: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 307 | { |
| 308 | self.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right..removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]remove().(Wrapperrust-analyzer cargo bimap 0.6.3 mem/Wrapper#::wraprust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`]wrap().(left)).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|right_rc| { |
| 309 | // unwrap is safe because we know right2left contains the key (it's a bimap) |
| 310 | let left_rc = self.right2leftrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#right2left..removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]remove().(&right_rc).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 311 | // at this point we can safely unwrap because the other pointers are gone |
| 312 | ( |
| 313 | Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::try_unwraprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`]try_unwrap().(left_rc.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 314 | Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::try_unwraprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`]try_unwrap().(right_rc.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 315 | ) |
| 316 | }) |
| 317 | } |
| 318 | |
| 319 | /// Removes the left-right pair corresponding to the given right value. |
| 320 | /// |
| 321 | /// Returns the previous left-right pair if the map contained the right |
| 322 | /// value and `None` otherwise. |
| 323 | /// |
| 324 | /// The input may be any borrowed form of the bimap's right type, but the |
| 325 | /// ordering on the borrowed form *must* match the ordering on the right |
| 326 | /// type. |
| 327 | /// |
| 328 | /// # Examples |
| 329 | /// |
| 330 | /// ``` |
| 331 | /// use bimap::BiBTreeMap; |
| 332 | /// |
| 333 | /// let mut bimap = BiBTreeMap::new(); |
| 334 | /// bimap.insert('a', 1); |
| 335 | /// bimap.insert('b', 2); |
| 336 | /// bimap.insert('c', 3); |
| 337 | /// |
| 338 | /// assert_eq!(bimap.remove_by_right(&2), Some(('b', 2))); |
| 339 | /// assert_eq!(bimap.remove_by_right(&2), None); |
| 340 | /// ``` |
| 341 | pub fn remove_by_rightrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]remove_by_right().<Q>(&mut self, right: &Q) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(L, R)> |
| 342 | where |
| 343 | R: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Q>, |
| 344 | Q: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 345 | { |
| 346 | self.right2leftrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#right2left..removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]remove().(Wrapperrust-analyzer cargo bimap 0.6.3 mem/Wrapper#::wraprust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`]wrap().(right)).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|left_rc| { |
| 347 | // unwrap is safe because we know left2right contains the key (it's a bimap) |
| 348 | let right_rc = self.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right..removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]remove().(&left_rc).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 349 | // at this point we can safely unwrap because the other pointers are gone |
| 350 | ( |
| 351 | Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::try_unwraprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`]try_unwrap().(left_rc.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 352 | Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::try_unwraprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`]try_unwrap().(right_rc.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 353 | ) |
| 354 | }) |
| 355 | } |
| 356 | |
| 357 | /// Retains only elements specified by a predicate |
| 358 | /// |
| 359 | /// In other words, remove all left-right pairs `(l, r)` such that `f(&l, |
| 360 | /// &r)` returns `false`. |
| 361 | /// |
| 362 | /// # Example |
| 363 | /// |
| 364 | /// ``` |
| 365 | /// use bimap::BiBTreeMap; |
| 366 | /// |
| 367 | /// let mut bimap = BiBTreeMap::new(); |
| 368 | /// bimap.insert('a', 1); |
| 369 | /// bimap.insert('b', 2); |
| 370 | /// bimap.insert('c', 3); |
| 371 | /// |
| 372 | /// bimap.retain(|&l, _| l != 'b'); |
| 373 | /// assert_eq!(bimap.len(), 2); |
| 374 | /// assert_eq!(bimap.get_by_right(&1), Some(&'a')); |
| 375 | /// assert_eq!(bimap.get_by_right(&2), None); |
| 376 | /// assert_eq!(bimap.get_by_right(&3), Some(&'c')); |
| 377 | /// ``` |
| 378 | pub fn retainrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]retain().<F>(&mut self, f: F) |
| 379 | where |
| 380 | F: FnMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnMut#(&L, &R) -> bool, |
| 381 | { |
| 382 | let mut f = f; |
| 383 | let right2left = &mut self.right2leftrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#right2left.; |
| 384 | self.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right..retainrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]retain().(|l, r| { |
| 385 | let to_retain = f(&l.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0., &r.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.); |
| 386 | if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().to_retain { |
| 387 | right2left.removerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]remove().(r); |
| 388 | } |
| 389 | to_retain |
| 390 | }) |
| 391 | } |
| 392 | |
| 393 | /// Inserts the given left-right pair into the bimap. |
| 394 | /// |
| 395 | /// Returns an enum `Overwritten` representing any left-right pairs that |
| 396 | /// were overwritten by the call to `insert`. The example below details |
| 397 | /// all possible enum variants that can be returned. |
| 398 | /// |
| 399 | /// # Warnings |
| 400 | /// |
| 401 | /// Somewhat paradoxically, calling `insert()` can actually reduce the size |
| 402 | /// of the bimap! This is because of the invariant that each left value |
| 403 | /// maps to exactly one right value and vice versa. |
| 404 | /// |
| 405 | /// # Examples |
| 406 | /// |
| 407 | /// ``` |
| 408 | /// use bimap::{BiBTreeMap, Overwritten}; |
| 409 | /// |
| 410 | /// let mut bimap = BiBTreeMap::new(); |
| 411 | /// assert_eq!(bimap.len(), 0); // {} |
| 412 | /// |
| 413 | /// // no values are overwritten. |
| 414 | /// assert_eq!(bimap.insert('a', 1), Overwritten::Neither); |
| 415 | /// assert_eq!(bimap.len(), 1); // {'a' <> 1} |
| 416 | /// |
| 417 | /// // no values are overwritten. |
| 418 | /// assert_eq!(bimap.insert('b', 2), Overwritten::Neither); |
| 419 | /// assert_eq!(bimap.len(), 2); // {'a' <> 1, 'b' <> 2} |
| 420 | /// |
| 421 | /// // ('a', 1) already exists, so inserting ('a', 4) overwrites 'a', the left value. |
| 422 | /// // the previous left-right pair ('a', 1) is returned. |
| 423 | /// assert_eq!(bimap.insert('a', 4), Overwritten::Left('a', 1)); |
| 424 | /// assert_eq!(bimap.len(), 2); // {'a' <> 4, 'b' <> 2} |
| 425 | /// |
| 426 | /// // ('b', 2) already exists, so inserting ('c', 2) overwrites 2, the right value. |
| 427 | /// // the previous left-right pair ('b', 2) is returned. |
| 428 | /// assert_eq!(bimap.insert('c', 2), Overwritten::Right('b', 2)); |
| 429 | /// assert_eq!(bimap.len(), 2); // {'a' <> 1, 'c' <> 2} |
| 430 | /// |
| 431 | /// // both ('a', 4) and ('c', 2) already exist, so inserting ('a', 2) overwrites both. |
| 432 | /// // ('a', 4) has the overwritten left value ('a'), so it's the first tuple returned. |
| 433 | /// // ('c', 2) has the overwritten right value (2), so it's the second tuple returned. |
| 434 | /// assert_eq!(bimap.insert('a', 2), Overwritten::Both(('a', 4), ('c', 2))); |
| 435 | /// assert_eq!(bimap.len(), 1); // {'a' <> 2} // bimap is smaller than before! |
| 436 | /// |
| 437 | /// // ('a', 2) already exists, so inserting ('a', 2) overwrites the pair. |
| 438 | /// // the previous left-right pair ('a', 2) is returned. |
| 439 | /// assert_eq!(bimap.insert('a', 2), Overwritten::Pair('a', 2)); |
| 440 | /// assert_eq!(bimap.len(), 1); // {'a' <> 2} |
| 441 | /// ``` |
| 442 | pub fn insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().(&mut self, left: L, right: R) -> Overwrittenrust-analyzer cargo bimap 0.6.3 Overwritten#<L, R> { |
| 443 | let retval = match (self.remove_by_leftrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]remove_by_left().(&left), self.remove_by_rightrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]remove_by_right().(&right)) { |
| 444 | (Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => Overwrittenrust-analyzer cargo bimap 0.6.3 Overwritten#::Neitherrust-analyzer cargo bimap 0.6.3 Overwritten#Neither#, |
| 445 | (Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(r_pair)) => Overwrittenrust-analyzer cargo bimap 0.6.3 Overwritten#::Rightrust-analyzer cargo bimap 0.6.3 Overwritten#Right#(r_pair.0, r_pair.1), |
| 446 | (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(l_pair), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => { |
| 447 | // since remove_by_left() was called first, it's possible the right value was |
| 448 | // removed if a duplicate pair is being inserted |
| 449 | if l_pair.1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#eq().right { |
| 450 | Overwrittenrust-analyzer cargo bimap 0.6.3 Overwritten#::Pairrust-analyzer cargo bimap 0.6.3 Overwritten#Pair#(l_pair.0, l_pair.1) |
| 451 | } else { |
| 452 | Overwrittenrust-analyzer cargo bimap 0.6.3 Overwritten#::Leftrust-analyzer cargo bimap 0.6.3 Overwritten#Left#(l_pair.0, l_pair.1) |
| 453 | } |
| 454 | } |
| 455 | (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(l_pair), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(r_pair)) => Overwrittenrust-analyzer cargo bimap 0.6.3 Overwritten#::Bothrust-analyzer cargo bimap 0.6.3 Overwritten#Both#(l_pair, r_pair), |
| 456 | }; |
| 457 | self.insert_uncheckedrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert_unchecked().(left, right); |
| 458 | retval |
| 459 | } |
| 460 | |
| 461 | /// Inserts the given left-right pair into the bimap without overwriting any |
| 462 | /// existing values. |
| 463 | /// |
| 464 | /// Returns `Ok(())` if the pair was successfully inserted into the bimap. |
| 465 | /// If either value exists in the map, `Err((left, right)` is returned |
| 466 | /// with the attempted left-right pair and the map is unchanged. |
| 467 | /// |
| 468 | /// # Examples |
| 469 | /// |
| 470 | /// ``` |
| 471 | /// use bimap::BiBTreeMap; |
| 472 | /// |
| 473 | /// let mut bimap = BiBTreeMap::new(); |
| 474 | /// assert_eq!(bimap.insert_no_overwrite('a', 1), Ok(())); |
| 475 | /// assert_eq!(bimap.insert_no_overwrite('b', 2), Ok(())); |
| 476 | /// assert_eq!(bimap.insert_no_overwrite('a', 3), Err(('a', 3))); |
| 477 | /// assert_eq!(bimap.insert_no_overwrite('c', 2), Err(('c', 2))); |
| 478 | /// ``` |
| 479 | pub fn insert_no_overwriterust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert_no_overwrite().(&mut self, left: L, right: R) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), (L, R)> { |
| 480 | if self.contains_leftrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]contains_left().(&left) || self.contains_rightrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]contains_right().(&right) { |
| 481 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#((left, right)) |
| 482 | } else { |
| 483 | self.insert_uncheckedrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert_unchecked().(left, right); |
| 484 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | /// Inserts the given left-right pair into the bimap without checking if the |
| 489 | /// pair already exists. |
| 490 | fn insert_uncheckedrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert_unchecked().(&mut self, left: L, right: R) { |
| 491 | let left = Refrust-analyzer cargo bimap 0.6.3 mem/Ref#(Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T>`]new().(left)); |
| 492 | let right_rc = Refrust-analyzer cargo bimap 0.6.3 mem/Ref#(Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T>`]new().(right)); |
| 493 | self.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right..insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().(left.clonerust-analyzer cargo bimap 0.6.3 mem/impl#[`Ref<T>`][Clone]clone().(), right_rc.clonerust-analyzer cargo bimap 0.6.3 mem/impl#[`Ref<T>`][Clone]clone().()); |
| 494 | self.right2leftrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#right2left..insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().(right_rc, left); |
| 495 | } |
| 496 | |
| 497 | /// Creates an iterator over the left-right pairs lying within a range of |
| 498 | /// left values in the bimap in ascending order by left. |
| 499 | /// |
| 500 | /// The iterator element type is `(&L, &R)`. |
| 501 | /// |
| 502 | /// The range bounds may be any borrowed form of the bimap's left type, but |
| 503 | /// the ordering on the borrowed form *must* match the ordering on the left |
| 504 | /// type. |
| 505 | /// |
| 506 | /// # Examples |
| 507 | /// |
| 508 | /// ``` |
| 509 | /// use bimap::BiBTreeMap; |
| 510 | /// |
| 511 | /// let mut bimap = BiBTreeMap::new(); |
| 512 | /// bimap.insert('a', 1); |
| 513 | /// bimap.insert('b', 2); |
| 514 | /// bimap.insert('c', 3); |
| 515 | /// bimap.insert('d', 4); |
| 516 | /// |
| 517 | /// for (left, right) in bimap.left_range('b'..'d') { |
| 518 | /// println!("({}, {})", left, right); |
| 519 | /// } |
| 520 | /// ``` |
| 521 | pub fn left_rangerust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]left_range().<T, A>(&self, range: A) -> LeftRangerust-analyzer cargo bimap 0.6.3 btree/LeftRange#<'_, L, R> |
| 522 | where |
| 523 | L: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<T>, |
| 524 | A: RangeBoundsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeBounds#<T>, |
| 525 | T: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 526 | { |
| 527 | let start = Wrapperrust-analyzer cargo bimap 0.6.3 mem/Wrapper#::wrap_boundrust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`]wrap_bound().(range.start_boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeBounds#start_bound().()); |
| 528 | let end = Wrapperrust-analyzer cargo bimap 0.6.3 mem/Wrapper#::wrap_boundrust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`]wrap_bound().(range.end_boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeBounds#end_bound().()); |
| 529 | LeftRangerust-analyzer cargo bimap 0.6.3 btree/LeftRange# { |
| 530 | innerrust-analyzer cargo bimap 0.6.3 btree/LeftRange#inner.: self.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right..rangerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]range().::<Wrapperrust-analyzer cargo bimap 0.6.3 mem/Wrapper#<_>, _>((start, end)), |
| 531 | } |
| 532 | } |
| 533 | |
| 534 | /// Creates an iterator over the left-right pairs lying within a range of |
| 535 | /// right values in the bimap in ascending order by right. |
| 536 | /// |
| 537 | /// The iterator element type is `(&L, &R)`. |
| 538 | /// |
| 539 | /// The range bounds may be any borrowed form of the bimap's right type, but |
| 540 | /// the ordering on the borrowed form *must* match the ordering on the right |
| 541 | /// type. |
| 542 | /// |
| 543 | /// # Examples |
| 544 | /// |
| 545 | /// ``` |
| 546 | /// use bimap::BiBTreeMap; |
| 547 | /// |
| 548 | /// let mut bimap = BiBTreeMap::new(); |
| 549 | /// bimap.insert('a', 1); |
| 550 | /// bimap.insert('b', 2); |
| 551 | /// bimap.insert('c', 3); |
| 552 | /// bimap.insert('d', 4); |
| 553 | /// |
| 554 | /// for (left, right) in bimap.right_range(2..4) { |
| 555 | /// println!("({}, {})", left, right); |
| 556 | /// } |
| 557 | /// ``` |
| 558 | pub fn right_rangerust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]right_range().<T, A>(&self, range: A) -> RightRangerust-analyzer cargo bimap 0.6.3 btree/RightRange#<'_, L, R> |
| 559 | where |
| 560 | R: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<T>, |
| 561 | A: RangeBoundsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeBounds#<T>, |
| 562 | T: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 563 | { |
| 564 | let start = Wrapperrust-analyzer cargo bimap 0.6.3 mem/Wrapper#::wrap_boundrust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`]wrap_bound().(range.start_boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeBounds#start_bound().()); |
| 565 | let end = Wrapperrust-analyzer cargo bimap 0.6.3 mem/Wrapper#::wrap_boundrust-analyzer cargo bimap 0.6.3 mem/impl#[`Wrapper<T>`]wrap_bound().(range.end_boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeBounds#end_bound().()); |
| 566 | RightRangerust-analyzer cargo bimap 0.6.3 btree/RightRange# { |
| 567 | innerrust-analyzer cargo bimap 0.6.3 btree/RightRange#inner.: self.right2leftrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#right2left..rangerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]range().::<Wrapperrust-analyzer cargo bimap 0.6.3 mem/Wrapper#<_>, _>((start, end)), |
| 568 | } |
| 569 | } |
| 570 | } |
| 571 | |
| 572 | impl<L, R> Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# for BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#<L, R> |
| 573 | where |
| 574 | L: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 575 | R: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 576 | { |
| 577 | fn clonerust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][Clone]clone().(&self) -> BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#<L, R> { |
| 578 | self.iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(l, r)| (l.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), r.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().())).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() |
| 579 | } |
| 580 | } |
| 581 | |
| 582 | impl<L, R> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#<L, R> |
| 583 | where |
| 584 | L: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 585 | R: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# + Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 586 | { |
| 587 | fn fmtrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][Debug]fmt().(&self, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 588 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{{")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 589 | for (i, (left, right)) in self.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right..iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() { |
| 590 | let comma = if i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0 { "" } else { ", " }; |
| 591 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}{:?} <> {:?}", comma, left, right)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 592 | } |
| 593 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "}}")?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 594 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 595 | } |
| 596 | } |
| 597 | |
| 598 | impl<L, R> Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#<L, R> |
| 599 | where |
| 600 | L: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 601 | R: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 602 | { |
| 603 | fn defaultrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][Default]default().() -> BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#<L, R> { |
| 604 | BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap# { |
| 605 | left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::defaultrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`][Default]default().(), |
| 606 | right2leftrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#right2left.: BTreeMaprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/BTreeMap#::defaultrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V>`][Default]default().(), |
| 607 | } |
| 608 | } |
| 609 | } |
| 610 | |
| 611 | impl<L, R> Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq# for BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#<L, R> |
| 612 | where |
| 613 | L: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 614 | R: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 615 | { |
| 616 | } |
| 617 | |
| 618 | impl<L, R> FromIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/FromIterator#<(L, R)> for BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#<L, R> |
| 619 | where |
| 620 | L: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 621 | R: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 622 | { |
| 623 | fn from_iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`FromIterator<(L, R)>`]from_iter().<I>(iter: I) -> BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#<L, R> |
| 624 | where |
| 625 | I: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# = (L, R)>, |
| 626 | { |
| 627 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 628 | for (left, right) in iter { |
| 629 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().(left, right); |
| 630 | } |
| 631 | bimap |
| 632 | } |
| 633 | } |
| 634 | |
| 635 | impl<'a, L, R> IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator# for &'a BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#<L, R> |
| 636 | where |
| 637 | L: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 638 | R: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 639 | { |
| 640 | type Itemrust-analyzer cargo bimap 0.6.3 btree/impl#[`&'a BiBTreeMap<L, R>`][IntoIterator]Item# = (&'a L, &'a R); |
| 641 | type IntoIterrust-analyzer cargo bimap 0.6.3 btree/impl#[`&'a BiBTreeMap<L, R>`][IntoIterator]IntoIter# = Iterrust-analyzer cargo bimap 0.6.3 btree/Iter#<'a, L, R>; |
| 642 | |
| 643 | fn into_iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`&'a BiBTreeMap<L, R>`][IntoIterator]into_iter().(self) -> Iterrust-analyzer cargo bimap 0.6.3 btree/Iter#<'a, L, R> { |
| 644 | self.iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]iter().() |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | impl<L, R> IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator# for BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#<L, R> |
| 649 | where |
| 650 | L: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 651 | R: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 652 | { |
| 653 | type Itemrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][IntoIterator]Item# = (L, R); |
| 654 | type IntoIterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][IntoIterator]IntoIter# = IntoIterrust-analyzer cargo bimap 0.6.3 btree/IntoIter#<L, R>; |
| 655 | |
| 656 | fn into_iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][IntoIterator]into_iter().(self) -> IntoIterrust-analyzer cargo bimap 0.6.3 btree/IntoIter#<L, R> { |
| 657 | IntoIterrust-analyzer cargo bimap 0.6.3 btree/IntoIter# { |
| 658 | innerrust-analyzer cargo bimap 0.6.3 btree/IntoIter#inner.: self.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right..into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`][IntoIterator]into_iter().(), |
| 659 | } |
| 660 | } |
| 661 | } |
| 662 | |
| 663 | impl<L, R> Extendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/Extend#<(L, R)> for BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#<L, R> |
| 664 | where |
| 665 | L: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 666 | R: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 667 | { |
| 668 | fn extendrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`Extend<(L, R)>`]extend().<T: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# = (L, R)>>(&mut self, iter: T) { |
| 669 | iter.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#into_iter().().for_eachrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#for_each().(move |(l, r)| { |
| 670 | self.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().(l, r); |
| 671 | }); |
| 672 | } |
| 673 | } |
| 674 | |
| 675 | impl<L, R> Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord# for BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#<L, R> |
| 676 | where |
| 677 | L: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 678 | R: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 679 | { |
| 680 | fn cmprust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][Ord]cmp().(&self, other: &Selfrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][Ord]) -> Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering# { |
| 681 | self.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right..cmprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`][Ord]cmp().(&other.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right.) |
| 682 | } |
| 683 | } |
| 684 | |
| 685 | impl<L, R> PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# for BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#<L, R> |
| 686 | where |
| 687 | L: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 688 | R: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 689 | { |
| 690 | fn eqrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`PartialEq<Self>`]eq().(&self, other: &Selfrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`PartialEq<Self>`]) -> bool { |
| 691 | self.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right. rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`][`PartialEq<Self>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`][`PartialEq<Self>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`][`PartialEq<Self>`]eq().other.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right. |
| 692 | } |
| 693 | } |
| 694 | |
| 695 | impl<L, R> PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd# for BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#<L, R> |
| 696 | where |
| 697 | L: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 698 | R: Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord#, |
| 699 | { |
| 700 | fn partial_cmprust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`PartialOrd<Self>`]partial_cmp().(&self, other: &Selfrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`PartialOrd<Self>`]) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#> { |
| 701 | self.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right..partial_cmprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`][`PartialOrd<Self>`]partial_cmp().(&other.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right.) |
| 702 | } |
| 703 | } |
| 704 | |
| 705 | impl<L, R> Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash# for BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#<L, R> |
| 706 | where |
| 707 | L: Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#, |
| 708 | R: Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#, |
| 709 | { |
| 710 | fn hashrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][Hash]hash().<H: Hasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hasher#>(&self, state: &mut H) { |
| 711 | self.left2rightrust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#left2right..hashrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`][Hash]hash().(state); |
| 712 | } |
| 713 | } |
| 714 | |
| 715 | /// An owning iterator over the left-right pairs in a `BiBTreeMap`. |
| 716 | pub struct IntoIterrust-analyzer cargo bimap 0.6.3 btree/IntoIter#<L, R> { |
| 717 | innerrust-analyzer cargo bimap 0.6.3 btree/IntoIter#inner.: btree_maprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree_map/::IntoIterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/IntoIter#<Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<L>, Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<R>>, |
| 718 | } |
| 719 | |
| 720 | impl<L, R> DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator# for IntoIterrust-analyzer cargo bimap 0.6.3 btree/IntoIter#<L, R> { |
| 721 | fn next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`IntoIter<L, R>`][DoubleEndedIterator]next_back().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo bimap 0.6.3 btree/impl#[`IntoIter<L, R>`][DoubleEndedIterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 722 | // unwraps are safe because right2left is gone |
| 723 | self.innerrust-analyzer cargo bimap 0.6.3 btree/IntoIter#inner..next_backrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`IntoIter<K, V, A>`][DoubleEndedIterator]next_back().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(l, r)| { |
| 724 | ( |
| 725 | Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::try_unwraprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`]try_unwrap().(l.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 726 | Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::try_unwraprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`]try_unwrap().(r.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 727 | ) |
| 728 | }) |
| 729 | } |
| 730 | } |
| 731 | |
| 732 | impl<L, R> ExactSizeIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator# for IntoIterrust-analyzer cargo bimap 0.6.3 btree/IntoIter#<L, R> {} |
| 733 | |
| 734 | impl<L, R> FusedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/marker/FusedIterator# for IntoIterrust-analyzer cargo bimap 0.6.3 btree/IntoIter#<L, R> {} |
| 735 | |
| 736 | impl<L, R> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for IntoIterrust-analyzer cargo bimap 0.6.3 btree/IntoIter#<L, R> { |
| 737 | type Itemrust-analyzer cargo bimap 0.6.3 btree/impl#[`IntoIter<L, R>`][Iterator]Item# = (L, R); |
| 738 | |
| 739 | fn nextrust-analyzer cargo bimap 0.6.3 btree/impl#[`IntoIter<L, R>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo bimap 0.6.3 btree/impl#[`IntoIter<L, R>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 740 | // unwraps are safe because right2left is gone |
| 741 | self.innerrust-analyzer cargo bimap 0.6.3 btree/IntoIter#inner..nextrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`IntoIter<K, V, A>`][Iterator]next().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(l, r)| { |
| 742 | ( |
| 743 | Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::try_unwraprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`]try_unwrap().(l.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 744 | Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::try_unwraprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`]try_unwrap().(r.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 745 | ) |
| 746 | }) |
| 747 | } |
| 748 | |
| 749 | fn size_hintrust-analyzer cargo bimap 0.6.3 btree/impl#[`IntoIter<L, R>`][Iterator]size_hint().(&self) -> (usize, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) { |
| 750 | self.innerrust-analyzer cargo bimap 0.6.3 btree/IntoIter#inner..size_hintrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`IntoIter<K, V, A>`][Iterator]size_hint().() |
| 751 | } |
| 752 | } |
| 753 | |
| 754 | /// An iterator over the left-right pairs in a `BiBTreeMap`. |
| 755 | /// |
| 756 | /// This struct is created by the [`iter`] method of `BiBTreeMap`. |
| 757 | /// |
| 758 | /// [`iter`]: BiBTreeMap::iter |
| 759 | #[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:)] |
| 760 | pub struct Iterrust-analyzer cargo bimap 0.6.3 btree/Iter#<'a, L, R> { |
| 761 | innerrust-analyzer cargo bimap 0.6.3 btree/Iter#inner.: btree_maprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree_map/::Iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/Iter#<'a, Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<L>, Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<R>>, |
| 762 | } |
| 763 | |
| 764 | impl<'a, L, R> DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator# for Iterrust-analyzer cargo bimap 0.6.3 btree/Iter#<'a, L, R> { |
| 765 | fn next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`Iter<'a, L, R>`][DoubleEndedIterator]next_back().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo bimap 0.6.3 btree/impl#[`Iter<'a, L, R>`][DoubleEndedIterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 766 | self.innerrust-analyzer cargo bimap 0.6.3 btree/Iter#inner..next_backrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Iter<'a, K, V>`][DoubleEndedIterator]next_back().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(l, r)| (&*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().l.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0., &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().r.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.)) |
| 767 | } |
| 768 | } |
| 769 | |
| 770 | impl<'a, L, R> ExactSizeIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator# for Iterrust-analyzer cargo bimap 0.6.3 btree/Iter#<'a, L, R> {} |
| 771 | |
| 772 | impl<'a, L, R> FusedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/marker/FusedIterator# for Iterrust-analyzer cargo bimap 0.6.3 btree/Iter#<'a, L, R> {} |
| 773 | |
| 774 | impl<'a, L, R> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for Iterrust-analyzer cargo bimap 0.6.3 btree/Iter#<'a, L, R> { |
| 775 | type Itemrust-analyzer cargo bimap 0.6.3 btree/impl#[`Iter<'a, L, R>`][Iterator]Item# = (&'a L, &'a R); |
| 776 | |
| 777 | fn nextrust-analyzer cargo bimap 0.6.3 btree/impl#[`Iter<'a, L, R>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo bimap 0.6.3 btree/impl#[`Iter<'a, L, R>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 778 | self.innerrust-analyzer cargo bimap 0.6.3 btree/Iter#inner..nextrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Iter<'a, K, V>`][Iterator]next().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(l, r)| (&*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().l.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0., &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().r.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.)) |
| 779 | } |
| 780 | |
| 781 | fn size_hintrust-analyzer cargo bimap 0.6.3 btree/impl#[`Iter<'a, L, R>`][Iterator]size_hint().(&self) -> (usize, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) { |
| 782 | self.innerrust-analyzer cargo bimap 0.6.3 btree/Iter#inner..size_hintrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Iter<'a, K, V>`][Iterator]size_hint().() |
| 783 | } |
| 784 | } |
| 785 | |
| 786 | /// An iterator over the left values in a `BiBTreeMap`. |
| 787 | /// |
| 788 | /// This struct is created by the [`left_values`] method of `BiBTreeMap`. |
| 789 | /// |
| 790 | /// [`left_values`]: BiBTreeMap::left_values |
| 791 | #[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:)] |
| 792 | pub struct LeftValuesrust-analyzer cargo bimap 0.6.3 btree/LeftValues#<'a, L, R> { |
| 793 | innerrust-analyzer cargo bimap 0.6.3 btree/LeftValues#inner.: btree_maprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree_map/::Iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/Iter#<'a, Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<L>, Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<R>>, |
| 794 | } |
| 795 | |
| 796 | impl<'a, L, R> DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator# for LeftValuesrust-analyzer cargo bimap 0.6.3 btree/LeftValues#<'a, L, R> { |
| 797 | fn next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`LeftValues<'a, L, R>`][DoubleEndedIterator]next_back().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo bimap 0.6.3 btree/impl#[`LeftValues<'a, L, R>`][DoubleEndedIterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 798 | self.innerrust-analyzer cargo bimap 0.6.3 btree/LeftValues#inner..next_backrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Iter<'a, K, V>`][DoubleEndedIterator]next_back().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(l, _)| &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().l.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.) |
| 799 | } |
| 800 | } |
| 801 | |
| 802 | impl<'a, L, R> ExactSizeIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator# for LeftValuesrust-analyzer cargo bimap 0.6.3 btree/LeftValues#<'a, L, R> {} |
| 803 | |
| 804 | impl<'a, L, R> FusedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/marker/FusedIterator# for LeftValuesrust-analyzer cargo bimap 0.6.3 btree/LeftValues#<'a, L, R> {} |
| 805 | |
| 806 | impl<'a, L, R> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for LeftValuesrust-analyzer cargo bimap 0.6.3 btree/LeftValues#<'a, L, R> { |
| 807 | type Itemrust-analyzer cargo bimap 0.6.3 btree/impl#[`LeftValues<'a, L, R>`][Iterator]Item# = &'a L; |
| 808 | |
| 809 | fn nextrust-analyzer cargo bimap 0.6.3 btree/impl#[`LeftValues<'a, L, R>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo bimap 0.6.3 btree/impl#[`LeftValues<'a, L, R>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 810 | self.innerrust-analyzer cargo bimap 0.6.3 btree/LeftValues#inner..nextrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Iter<'a, K, V>`][Iterator]next().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(l, _)| &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().l.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.) |
| 811 | } |
| 812 | |
| 813 | fn size_hintrust-analyzer cargo bimap 0.6.3 btree/impl#[`LeftValues<'a, L, R>`][Iterator]size_hint().(&self) -> (usize, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) { |
| 814 | self.innerrust-analyzer cargo bimap 0.6.3 btree/LeftValues#inner..size_hintrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Iter<'a, K, V>`][Iterator]size_hint().() |
| 815 | } |
| 816 | } |
| 817 | |
| 818 | /// An iterator over the right values in a `BiBTreeMap`. |
| 819 | /// |
| 820 | /// This struct is created by the [`right_values`] method of `BiBTreeMap`. |
| 821 | /// |
| 822 | /// [`right_values`]: BiBTreeMap::right_values |
| 823 | #[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:)] |
| 824 | pub struct RightValuesrust-analyzer cargo bimap 0.6.3 btree/RightValues#<'a, L, R> { |
| 825 | innerrust-analyzer cargo bimap 0.6.3 btree/RightValues#inner.: btree_maprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree_map/::Iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/Iter#<'a, Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<R>, Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<L>>, |
| 826 | } |
| 827 | |
| 828 | impl<'a, L, R> DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator# for RightValuesrust-analyzer cargo bimap 0.6.3 btree/RightValues#<'a, L, R> { |
| 829 | fn next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`RightValues<'a, L, R>`][DoubleEndedIterator]next_back().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo bimap 0.6.3 btree/impl#[`RightValues<'a, L, R>`][DoubleEndedIterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 830 | self.innerrust-analyzer cargo bimap 0.6.3 btree/RightValues#inner..next_backrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Iter<'a, K, V>`][DoubleEndedIterator]next_back().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(r, _)| &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().r.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.) |
| 831 | } |
| 832 | } |
| 833 | |
| 834 | impl<'a, L, R> ExactSizeIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator# for RightValuesrust-analyzer cargo bimap 0.6.3 btree/RightValues#<'a, L, R> {} |
| 835 | |
| 836 | impl<'a, L, R> FusedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/marker/FusedIterator# for RightValuesrust-analyzer cargo bimap 0.6.3 btree/RightValues#<'a, L, R> {} |
| 837 | |
| 838 | impl<'a, L, R> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for RightValuesrust-analyzer cargo bimap 0.6.3 btree/RightValues#<'a, L, R> { |
| 839 | type Itemrust-analyzer cargo bimap 0.6.3 btree/impl#[`RightValues<'a, L, R>`][Iterator]Item# = &'a R; |
| 840 | |
| 841 | fn nextrust-analyzer cargo bimap 0.6.3 btree/impl#[`RightValues<'a, L, R>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo bimap 0.6.3 btree/impl#[`RightValues<'a, L, R>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 842 | self.innerrust-analyzer cargo bimap 0.6.3 btree/RightValues#inner..nextrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Iter<'a, K, V>`][Iterator]next().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(r, _)| &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().r.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.) |
| 843 | } |
| 844 | |
| 845 | fn size_hintrust-analyzer cargo bimap 0.6.3 btree/impl#[`RightValues<'a, L, R>`][Iterator]size_hint().(&self) -> (usize, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) { |
| 846 | self.innerrust-analyzer cargo bimap 0.6.3 btree/RightValues#inner..size_hintrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Iter<'a, K, V>`][Iterator]size_hint().() |
| 847 | } |
| 848 | } |
| 849 | |
| 850 | /// An iterator over a range of left-right pairs in a `BiBTreeMap`. |
| 851 | /// |
| 852 | /// This struct is created by the [`left_range`] method of `BiBTreeMap`. |
| 853 | /// |
| 854 | /// [`left_range`]: BiBTreeMap::left_range |
| 855 | #[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:)] |
| 856 | pub struct LeftRangerust-analyzer cargo bimap 0.6.3 btree/LeftRange#<'a, L, R> { |
| 857 | innerrust-analyzer cargo bimap 0.6.3 btree/LeftRange#inner.: btree_maprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree_map/::Rangerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/Range#<'a, Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<L>, Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<R>>, |
| 858 | } |
| 859 | |
| 860 | impl<'a, L, R> DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator# for LeftRangerust-analyzer cargo bimap 0.6.3 btree/LeftRange#<'a, L, R> { |
| 861 | fn next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`LeftRange<'a, L, R>`][DoubleEndedIterator]next_back().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo bimap 0.6.3 btree/impl#[`LeftRange<'a, L, R>`][DoubleEndedIterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 862 | self.innerrust-analyzer cargo bimap 0.6.3 btree/LeftRange#inner..next_backrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Range<'a, K, V>`][DoubleEndedIterator]next_back().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(l, r)| (&*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().l.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0., &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().r.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.)) |
| 863 | } |
| 864 | } |
| 865 | |
| 866 | impl<'a, L, R> ExactSizeIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator# for LeftRangerust-analyzer cargo bimap 0.6.3 btree/LeftRange#<'a, L, R> {} |
| 867 | |
| 868 | impl<'a, L, R> FusedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/marker/FusedIterator# for LeftRangerust-analyzer cargo bimap 0.6.3 btree/LeftRange#<'a, L, R> {} |
| 869 | |
| 870 | impl<'a, L, R> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for LeftRangerust-analyzer cargo bimap 0.6.3 btree/LeftRange#<'a, L, R> { |
| 871 | type Itemrust-analyzer cargo bimap 0.6.3 btree/impl#[`LeftRange<'a, L, R>`][Iterator]Item# = (&'a L, &'a R); |
| 872 | |
| 873 | fn nextrust-analyzer cargo bimap 0.6.3 btree/impl#[`LeftRange<'a, L, R>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo bimap 0.6.3 btree/impl#[`LeftRange<'a, L, R>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 874 | self.innerrust-analyzer cargo bimap 0.6.3 btree/LeftRange#inner..nextrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Range<'a, K, V>`][Iterator]next().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(l, r)| (&*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().l.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0., &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().r.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.)) |
| 875 | } |
| 876 | |
| 877 | fn size_hintrust-analyzer cargo bimap 0.6.3 btree/impl#[`LeftRange<'a, L, R>`][Iterator]size_hint().(&self) -> (usize, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) { |
| 878 | self.innerrust-analyzer cargo bimap 0.6.3 btree/LeftRange#inner..size_hintrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#size_hint().() |
| 879 | } |
| 880 | } |
| 881 | |
| 882 | /// An iterator over a range of left-right pairs in a `BiBTreeMap`. |
| 883 | /// |
| 884 | /// This struct is created by the [`right_range`] method of `BiBTreeMap`. |
| 885 | /// |
| 886 | /// [`right_range`]: BiBTreeMap::right_range |
| 887 | #[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:)] |
| 888 | pub struct RightRangerust-analyzer cargo bimap 0.6.3 btree/RightRange#<'a, L, R> { |
| 889 | innerrust-analyzer cargo bimap 0.6.3 btree/RightRange#inner.: btree_maprust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree_map/::Rangerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/Range#<'a, Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<R>, Refrust-analyzer cargo bimap 0.6.3 mem/Ref#<L>>, |
| 890 | } |
| 891 | |
| 892 | impl<'a, L, R> DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator# for RightRangerust-analyzer cargo bimap 0.6.3 btree/RightRange#<'a, L, R> { |
| 893 | fn next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`RightRange<'a, L, R>`][DoubleEndedIterator]next_back().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo bimap 0.6.3 btree/impl#[`RightRange<'a, L, R>`][DoubleEndedIterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 894 | self.innerrust-analyzer cargo bimap 0.6.3 btree/RightRange#inner..next_backrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Range<'a, K, V>`][DoubleEndedIterator]next_back().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(r, l)| (&*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().l.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0., &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().r.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.)) |
| 895 | } |
| 896 | } |
| 897 | |
| 898 | impl<'a, L, R> ExactSizeIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/exact_size/ExactSizeIterator# for RightRangerust-analyzer cargo bimap 0.6.3 btree/RightRange#<'a, L, R> {} |
| 899 | |
| 900 | impl<'a, L, R> FusedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/marker/FusedIterator# for RightRangerust-analyzer cargo bimap 0.6.3 btree/RightRange#<'a, L, R> {} |
| 901 | |
| 902 | impl<'a, L, R> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for RightRangerust-analyzer cargo bimap 0.6.3 btree/RightRange#<'a, L, R> { |
| 903 | type Itemrust-analyzer cargo bimap 0.6.3 btree/impl#[`RightRange<'a, L, R>`][Iterator]Item# = (&'a L, &'a R); |
| 904 | |
| 905 | fn nextrust-analyzer cargo bimap 0.6.3 btree/impl#[`RightRange<'a, L, R>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo bimap 0.6.3 btree/impl#[`RightRange<'a, L, R>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 906 | self.innerrust-analyzer cargo bimap 0.6.3 btree/RightRange#inner..nextrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`Range<'a, K, V>`][Iterator]next().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|(r, l)| (&*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().l.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0., &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().r.0rust-analyzer cargo bimap 0.6.3 mem/Ref#0.)) |
| 907 | } |
| 908 | |
| 909 | fn size_hintrust-analyzer cargo bimap 0.6.3 btree/impl#[`RightRange<'a, L, R>`][Iterator]size_hint().(&self) -> (usize, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) { |
| 910 | self.innerrust-analyzer cargo bimap 0.6.3 btree/RightRange#inner..size_hintrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#size_hint().() |
| 911 | } |
| 912 | } |
| 913 | |
| 914 | // safe because internal Rcs are not exposed by the api and the reference counts |
| 915 | // only change in methods with &mut self |
| 916 | unsafe impl<L, R> Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send# for BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#<L, R> |
| 917 | where |
| 918 | L: Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 919 | R: Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send#, |
| 920 | { |
| 921 | } |
| 922 | |
| 923 | unsafe impl<L, R> Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# for BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#<L, R> |
| 924 | where |
| 925 | L: Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#, |
| 926 | R: Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync#, |
| 927 | { |
| 928 | } |
| 929 | |
| 930 | #[cfg(test)] |
| 931 | mod testsrust-analyzer cargo bimap 0.6.3 btree/tests/ { |
| 932 | use superrust-analyzer cargo bimap 0.6.3 btree/::*; |
| 933 | |
| 934 | #[cfg(not(feature = "std"))] |
| 935 | use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::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#; |
| 936 | |
| 937 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 938 | fn clonerust-analyzer cargo bimap 0.6.3 btree/tests/clone().() { |
| 939 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 940 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 1); |
| 941 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 2); |
| 942 | let bimap2 = bimap.clonerust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][Clone]clone().(); |
| 943 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap, bimap2); |
| 944 | } |
| 945 | |
| 946 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 947 | fn deep_clonerust-analyzer cargo bimap 0.6.3 btree/tests/deep_clone().() { |
| 948 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 949 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 1); |
| 950 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 2); |
| 951 | let mut bimap2 = bimap.clonerust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][Clone]clone().(); |
| 952 | |
| 953 | // would panic if clone() didn't deep clone |
| 954 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 5); |
| 955 | bimap2.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 12); |
| 956 | bimap2.remove_by_leftrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]remove_by_left().(&'a'); |
| 957 | bimap.remove_by_rightrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]remove_by_right().(&2); |
| 958 | } |
| 959 | |
| 960 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 961 | fn debugrust-analyzer cargo bimap 0.6.3 btree/tests/debug().() { |
| 962 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 963 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("{}", formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:?}", bimap)); |
| 964 | |
| 965 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 1); |
| 966 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("{'a' <> 1}", formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:?}", bimap)); |
| 967 | |
| 968 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 2); |
| 969 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("{'a' <> 1, 'b' <> 2}", formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:?}", bimap)); |
| 970 | } |
| 971 | |
| 972 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 973 | fn defaultrust-analyzer cargo bimap 0.6.3 btree/tests/default().() { |
| 974 | let _ = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::<char, i32>::defaultrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][Default]default().(); |
| 975 | } |
| 976 | |
| 977 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 978 | fn eqrust-analyzer cargo bimap 0.6.3 btree/tests/eq().() { |
| 979 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 980 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap, bimap); |
| 981 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 1); |
| 982 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap, bimap); |
| 983 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 2); |
| 984 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap, bimap); |
| 985 | |
| 986 | let mut bimap2 = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 987 | assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!(bimap, bimap2); |
| 988 | bimap2.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 1); |
| 989 | assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!(bimap, bimap2); |
| 990 | bimap2.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 2); |
| 991 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap, bimap2); |
| 992 | bimap2.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('c', 3); |
| 993 | assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!(bimap, bimap2); |
| 994 | } |
| 995 | |
| 996 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 997 | fn from_iterrust-analyzer cargo bimap 0.6.3 btree/tests/from_iter().() { |
| 998 | let bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::from_iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`FromIterator<(L, R)>`]from_iter().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 999 | ('a', 1), |
| 1000 | ('b', 2), |
| 1001 | ('c', 3), |
| 1002 | ('b', 2), |
| 1003 | ('a', 4), |
| 1004 | ('b', 3), |
| 1005 | ]); |
| 1006 | let mut bimap2 = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 1007 | bimap2.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 4); |
| 1008 | bimap2.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 3); |
| 1009 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap, bimap2); |
| 1010 | } |
| 1011 | |
| 1012 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1013 | fn into_iterrust-analyzer cargo bimap 0.6.3 btree/tests/into_iter().() { |
| 1014 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 1015 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 3); |
| 1016 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 2); |
| 1017 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('c', 1); |
| 1018 | let pairs = bimap.into_iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][IntoIterator]into_iter().().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#<_>>(); |
| 1019 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(pairs, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![('a', 3), ('b', 2), ('c', 1)]); |
| 1020 | } |
| 1021 | |
| 1022 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1023 | fn into_iter_refrust-analyzer cargo bimap 0.6.3 btree/tests/into_iter_ref().() { |
| 1024 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 1025 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 3); |
| 1026 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 2); |
| 1027 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('c', 1); |
| 1028 | let pairs = (&bimap).into_iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`&'a BiBTreeMap<L, R>`][IntoIterator]into_iter().().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#<_>>(); |
| 1029 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(pairs, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(&'a', &3), (&'b', &2), (&'c', &1)]); |
| 1030 | } |
| 1031 | |
| 1032 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1033 | fn extendrust-analyzer cargo bimap 0.6.3 btree/tests/extend().() { |
| 1034 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 1035 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 3); |
| 1036 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 2); |
| 1037 | bimap.extendrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`Extend<(L, R)>`]extend().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![('c', 3), ('b', 1), ('a', 4)]); |
| 1038 | let mut bimap2 = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 1039 | bimap2.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 4); |
| 1040 | bimap2.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 1); |
| 1041 | bimap2.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('c', 3); |
| 1042 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap, bimap2); |
| 1043 | } |
| 1044 | |
| 1045 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1046 | fn cmprust-analyzer cargo bimap 0.6.3 btree/tests/cmp().() { |
| 1047 | let bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::from_iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`FromIterator<(L, R)>`]from_iter().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![('a', 2)]); |
| 1048 | let bimap2 = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::from_iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`FromIterator<(L, R)>`]from_iter().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![('b', 1)]); |
| 1049 | |
| 1050 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap.partial_cmprust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`PartialOrd<Self>`]partial_cmp().(&bimap2), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#::Lessrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#Less#)); |
| 1051 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap.cmprust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][Ord]cmp().(&bimap2), Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#::Lessrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#Less#); |
| 1052 | |
| 1053 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap2.partial_cmprust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`PartialOrd<Self>`]partial_cmp().(&bimap), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#::Greaterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#Greater#)); |
| 1054 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap2.cmprust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][Ord]cmp().(&bimap), Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#::Greaterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#Greater#); |
| 1055 | |
| 1056 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap.cmprust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][Ord]cmp().(&bimap), Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#::Equalrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#Equal#); |
| 1057 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap2.cmprust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][Ord]cmp().(&bimap2), Orderingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#::Equalrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ordering#Equal#); |
| 1058 | } |
| 1059 | |
| 1060 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1061 | fn iterrust-analyzer cargo bimap 0.6.3 btree/tests/iter().() { |
| 1062 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 1063 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 1); |
| 1064 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 2); |
| 1065 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('c', 3); |
| 1066 | let pairs = bimap.iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(c, i)| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().c, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().i)).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#<_>>(); |
| 1067 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(pairs, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![('a', 1), ('b', 2), ('c', 3)]); |
| 1068 | } |
| 1069 | |
| 1070 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1071 | fn iter_revrust-analyzer cargo bimap 0.6.3 btree/tests/iter_rev().() { |
| 1072 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 1073 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 1); |
| 1074 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 2); |
| 1075 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('c', 3); |
| 1076 | |
| 1077 | let mut iter = bimap.iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]iter().(); |
| 1078 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`Iter<'a, L, R>`][DoubleEndedIterator]next_back().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&'c', &3))); |
| 1079 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`Iter<'a, L, R>`][DoubleEndedIterator]next_back().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&'b', &2))); |
| 1080 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`Iter<'a, L, R>`][DoubleEndedIterator]next_back().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&'a', &1))); |
| 1081 | } |
| 1082 | |
| 1083 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1084 | fn into_iter_revrust-analyzer cargo bimap 0.6.3 btree/tests/into_iter_rev().() { |
| 1085 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 1086 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 1); |
| 1087 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 2); |
| 1088 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('c', 3); |
| 1089 | |
| 1090 | let mut iter = bimap.into_iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][IntoIterator]into_iter().(); |
| 1091 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`IntoIter<L, R>`][DoubleEndedIterator]next_back().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(('c', 3))); |
| 1092 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`IntoIter<L, R>`][DoubleEndedIterator]next_back().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(('b', 2))); |
| 1093 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`IntoIter<L, R>`][DoubleEndedIterator]next_back().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(('a', 1))); |
| 1094 | } |
| 1095 | |
| 1096 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1097 | fn left_valuesrust-analyzer cargo bimap 0.6.3 btree/tests/left_values().() { |
| 1098 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 1099 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 3); |
| 1100 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 2); |
| 1101 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('c', 1); |
| 1102 | let left_values = bimap.left_valuesrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]left_values().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().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#<_>>(); |
| 1103 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(left_values, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!['a', 'b', 'c']) |
| 1104 | } |
| 1105 | |
| 1106 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1107 | fn left_values_revrust-analyzer cargo bimap 0.6.3 btree/tests/left_values_rev().() { |
| 1108 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 1109 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 3); |
| 1110 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 2); |
| 1111 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('c', 1); |
| 1112 | |
| 1113 | let mut iter = bimap.left_valuesrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]left_values().(); |
| 1114 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`LeftValues<'a, L, R>`][DoubleEndedIterator]next_back().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&'c')); |
| 1115 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`LeftValues<'a, L, R>`][DoubleEndedIterator]next_back().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&'b')); |
| 1116 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`LeftValues<'a, L, R>`][DoubleEndedIterator]next_back().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&'a')); |
| 1117 | } |
| 1118 | |
| 1119 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1120 | fn right_valuesrust-analyzer cargo bimap 0.6.3 btree/tests/right_values().() { |
| 1121 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 1122 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 3); |
| 1123 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 2); |
| 1124 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('c', 1); |
| 1125 | let right_values = bimap.right_valuesrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]right_values().().clonedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#cloned().().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#<_>>(); |
| 1126 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(right_values, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1, 2, 3]) |
| 1127 | } |
| 1128 | |
| 1129 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1130 | fn right_values_revrust-analyzer cargo bimap 0.6.3 btree/tests/right_values_rev().() { |
| 1131 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 1132 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 3); |
| 1133 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 2); |
| 1134 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('c', 1); |
| 1135 | |
| 1136 | let mut iter = bimap.right_valuesrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]right_values().(); |
| 1137 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`RightValues<'a, L, R>`][DoubleEndedIterator]next_back().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&3)); |
| 1138 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`RightValues<'a, L, R>`][DoubleEndedIterator]next_back().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&2)); |
| 1139 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(iter.next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`RightValues<'a, L, R>`][DoubleEndedIterator]next_back().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&1)); |
| 1140 | } |
| 1141 | |
| 1142 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1143 | fn left_rangerust-analyzer cargo bimap 0.6.3 btree/tests/left_range().() { |
| 1144 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 1145 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 4); |
| 1146 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 3); |
| 1147 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('c', 2); |
| 1148 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('d', 1); |
| 1149 | let left_range = bimap |
| 1150 | .left_rangerust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]left_range().('b'..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#'d') |
| 1151 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(l, r)| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().l, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().r)) |
| 1152 | .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#<_>>(); |
| 1153 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(left_range, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![('b', 3), ('c', 2)]) |
| 1154 | } |
| 1155 | |
| 1156 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1157 | fn left_range_revrust-analyzer cargo bimap 0.6.3 btree/tests/left_range_rev().() { |
| 1158 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 1159 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 4); |
| 1160 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 3); |
| 1161 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('c', 2); |
| 1162 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('d', 1); |
| 1163 | let mut left_range = bimap.left_rangerust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]left_range().('b'..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#'d'); |
| 1164 | |
| 1165 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(left_range.next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`LeftRange<'a, L, R>`][DoubleEndedIterator]next_back().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&'c', &2))); |
| 1166 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(left_range.next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`LeftRange<'a, L, R>`][DoubleEndedIterator]next_back().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&'b', &3))); |
| 1167 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(left_range.next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`LeftRange<'a, L, R>`][DoubleEndedIterator]next_back().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1168 | } |
| 1169 | |
| 1170 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1171 | fn right_rangerust-analyzer cargo bimap 0.6.3 btree/tests/right_range().() { |
| 1172 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 1173 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 4); |
| 1174 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 3); |
| 1175 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('c', 2); |
| 1176 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('d', 1); |
| 1177 | let right_range = bimap |
| 1178 | .right_rangerust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]right_range().(2..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#4) |
| 1179 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(l, r)| (*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().l, *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().r)) |
| 1180 | .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#<_>>(); |
| 1181 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(right_range, vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![('c', 2), ('b', 3)]) |
| 1182 | } |
| 1183 | |
| 1184 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1185 | fn right_range_revrust-analyzer cargo bimap 0.6.3 btree/tests/right_range_rev().() { |
| 1186 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 1187 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 4); |
| 1188 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 3); |
| 1189 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('c', 2); |
| 1190 | bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('d', 1); |
| 1191 | let mut right_range = bimap.right_rangerust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]right_range().(2..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#4); |
| 1192 | |
| 1193 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(right_range.next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`RightRange<'a, L, R>`][DoubleEndedIterator]next_back().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&'b', &3))); |
| 1194 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(right_range.next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`RightRange<'a, L, R>`][DoubleEndedIterator]next_back().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((&'c', &2))); |
| 1195 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(right_range.next_backrust-analyzer cargo bimap 0.6.3 btree/impl#[`RightRange<'a, L, R>`][DoubleEndedIterator]next_back().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1196 | } |
| 1197 | |
| 1198 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1199 | fn clearrust-analyzer cargo bimap 0.6.3 btree/tests/clear().() { |
| 1200 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::from_iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`FromIterator<(L, R)>`]from_iter().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![('a', 1)]); |
| 1201 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap.lenrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]len().(), 1); |
| 1202 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().bimap.is_emptyrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]is_empty().()); |
| 1203 | |
| 1204 | bimap.clearrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]clear().(); |
| 1205 | |
| 1206 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap.lenrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]len().(), 0); |
| 1207 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(bimap.is_emptyrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]is_empty().()); |
| 1208 | } |
| 1209 | |
| 1210 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1211 | fn get_containsrust-analyzer cargo bimap 0.6.3 btree/tests/get_contains().() { |
| 1212 | let bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::from_iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`FromIterator<(L, R)>`]from_iter().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![('a', 1)]); |
| 1213 | |
| 1214 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap.get_by_leftrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]get_by_left().(&'a'), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&1)); |
| 1215 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(bimap.contains_leftrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]contains_left().(&'a')); |
| 1216 | |
| 1217 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap.get_by_leftrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]get_by_left().(&'b'), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1218 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().bimap.contains_leftrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]contains_left().(&'b')); |
| 1219 | |
| 1220 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap.get_by_rightrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]get_by_right().(&1), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(&'a')); |
| 1221 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(bimap.contains_rightrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]contains_right().(&1)); |
| 1222 | |
| 1223 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap.get_by_rightrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]get_by_right().(&2), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#); |
| 1224 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().bimap.contains_rightrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]contains_right().(&2)); |
| 1225 | } |
| 1226 | |
| 1227 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1228 | fn insertrust-analyzer cargo bimap 0.6.3 btree/tests/insert().() { |
| 1229 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 1230 | |
| 1231 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 1), Overwrittenrust-analyzer cargo bimap 0.6.3 Overwritten#::Neitherrust-analyzer cargo bimap 0.6.3 Overwritten#Neither#); |
| 1232 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('a', 2), Overwrittenrust-analyzer cargo bimap 0.6.3 Overwritten#::Leftrust-analyzer cargo bimap 0.6.3 Overwritten#Left#('a', 1)); |
| 1233 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 2), Overwrittenrust-analyzer cargo bimap 0.6.3 Overwritten#::Rightrust-analyzer cargo bimap 0.6.3 Overwritten#Right#('a', 2)); |
| 1234 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 2), Overwrittenrust-analyzer cargo bimap 0.6.3 Overwritten#::Pairrust-analyzer cargo bimap 0.6.3 Overwritten#Pair#('b', 2)); |
| 1235 | |
| 1236 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('c', 3), Overwrittenrust-analyzer cargo bimap 0.6.3 Overwritten#::Neitherrust-analyzer cargo bimap 0.6.3 Overwritten#Neither#); |
| 1237 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(bimap.insertrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert().('b', 3), Overwrittenrust-analyzer cargo bimap 0.6.3 Overwritten#::Bothrust-analyzer cargo bimap 0.6.3 Overwritten#Both#(('b', 2), ('c', 3))); |
| 1238 | } |
| 1239 | |
| 1240 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1241 | fn insert_no_overwriterust-analyzer cargo bimap 0.6.3 btree/tests/insert_no_overwrite().() { |
| 1242 | let mut bimap = BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(); |
| 1243 | |
| 1244 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(bimap.insert_no_overwriterust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert_no_overwrite().('a', 1).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().()); |
| 1245 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(bimap.insert_no_overwriterust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert_no_overwrite().('a', 2).is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 1246 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(bimap.insert_no_overwriterust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]insert_no_overwrite().('b', 1).is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().()); |
| 1247 | } |
| 1248 | |
| 1249 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 1250 | #[cfg(feature = "std")] |
| 1251 | fn hashrust-analyzer cargo bimap 0.6.3 btree/tests/hash().() { |
| 1252 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::{selfrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/, FromIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/FromIterator#}; |
| 1253 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#; |
| 1254 | |
| 1255 | let mut hashset = HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T>`]new().(); |
| 1256 | |
| 1257 | hashset.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().(BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().()); |
| 1258 | |
| 1259 | hashset.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().(BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::from_iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`FromIterator<(L, R)>`]from_iter().(iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/once/once().((0, '0')))); |
| 1260 | |
| 1261 | hashset.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().(BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::from_iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`FromIterator<(L, R)>`]from_iter().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(0, '0'), (0, '1'), (1, '0')])); |
| 1262 | hashset.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().(BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::from_iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`FromIterator<(L, R)>`]from_iter().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(1, '0'), (0, '1'), (0, '0')])); |
| 1263 | hashset.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S, A>`]insert().(BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::from_iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`FromIterator<(L, R)>`]from_iter().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(0, '0'), (0, '1'), (1, '0')])); |
| 1264 | |
| 1265 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 1266 | hashset, |
| 1267 | HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#::from_iterrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/impl#[`HashSet<T, S>`][`FromIterator<T>`]from_iter().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 1268 | BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::newrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`]new().(), |
| 1269 | BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::from_iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`FromIterator<(L, R)>`]from_iter().(iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/once/once().((0, '0'))), |
| 1270 | BiBTreeMaprust-analyzer cargo bimap 0.6.3 btree/BiBTreeMap#::from_iterrust-analyzer cargo bimap 0.6.3 btree/impl#[`BiBTreeMap<L, R>`][`FromIterator<(L, R)>`]from_iter().(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![(0, '0'), (1, '0'), (0, '1')]), |
| 1271 | ]) |
| 1272 | ); |
| 1273 | } |
| 1274 | } |