Files
thefoldwithin-earth/.old2/target/wasm32-unknown-unknown/release/deps/libequivalent-2be18f268db8187f.rmeta
T

25 lines
7.8 KiB
Plaintext
Raw Normal View History

2025-10-19 16:48:12 -05:00
rust
«#rustc 1.90.0 (1159e78c4 2025-09-14)Á˜ø½E—y88àìOg[-a0f3a77406fcd134ÁÒµÅL®Ùp,ØnWš÷*Ó-eed239b623db52f0Á˜
EquivalentÁ
equivalentÁ³»
ComparableÁ ³ compareÁгþ88 8 88888 г ×Ý d¸
ÝÝ׸ü¤!
É××S-Ë üôW$• ×,‚ ÝkeyÁ"QŽɽ Žä§
í×F)ÉüöS…Ò†Ò‡ÒLessÁˆÒ‰ÒŠÒ‹ÒŒÒÒGreaterÁŽÒ+8_)º[ÄD”,Žˆë±©Žõ ˜g4ÜÛÒ…ÒüËüLI [`Equivalent`] and [`Comparable`] are traits for key comparison in maps.ÁM©üQMJ These may be used in the implementation of maps where the lookup type `Q`ÁüŸ2/ may be different than the stored key type `K`.ÁÒ©üÖLI * `Q: Equivalent<K>` checks for equality, similar to the `HashMap<K, V>`Áü£'$ constraint `K: Borrow<Q>, Q: Eq`.ÁüËMJ * `Q: Comparable<K>` checks the ordering, similar to the `BTreeMap<K, V>`Áü™(% constraint `K: Borrow<Q>, Q: Ord`.Á©üÆOL These traits are not used by the maps in the standard library, but they mayÁü–JG add more flexibility in third-party map implementations, especially inÁüáKH situations where a strict `K: Borrow<Q>` relationship is not available.Á­© # ExamplesÁÀ© ```Á´Ì use equivalent::*;ÁÜã use std::cmp::Ordering;Áÿ©üƒ(% pub struct Pair<A, B>(pub A, pub B);Á¬©ü°RO impl<'a, A: ?Sized, B: ?Sized, C, D> Equivalent<(C, D)> for Pair<&'a A, &'a B>Á whereÁÌ A: Equivalent<C>,Á̧ B: Equivalent<D>,ÁüÇ41 fn equivalent(&self, key: &(C, D)) -> bool {ÁüüB? self.0.equivalent(&key.0) && self.1.equivalent(&key.1)ÁL¿Ï©üÓRO impl<'a, A: ?Sized, B: ?Sized, C, D> Comparable<(C, D)> for Pair<&'a A, &'a B>Áḭ̈  A: Comparable<C>,ÁÌÊ  B: Comparable<D>,ÁÂüê 52 fn compare(&self, key: &(C, D)) -> Ordering {Áü 
*' match self.0.compare(&key.0) {ÁüË
:7 Ordering::Equal => self.1.compare(&key.1),Áü† '$ not_equal => not_equal,Á
 × èÌ © fn main() {Áüà =: let key = (String::from("foo"), String::from("bar"));Áüž $! let q1 = Pair("foo", "bar");Áüà $! let q2 = Pair("boo", "bar");Áüè $! let q3 = Pair("foo", "baz");Á
©ü‘
%" assert!(q1.equivalent(&key));Áü·
&# assert!(!q2.equivalent(&key));ÁüÞ
&# assert!(!q3.equivalent(&key));Á©ü‰63 assert_eq!(q1.compare(&key), Ordering::Equal);ÁüÀ52 assert_eq!(q2.compare(&key), Ordering::Less);Áüö85 assert_eq!(q3.compare(&key), Ordering::Greater);Áèý
 ˜gÛÒ£…ҤΜè£üûÔþ Key equivalence trait.Á©üLI This trait allows hash table lookup to be customized. It has one blanketÁüêNK implementation that uses the regular solution with `Borrow` and `Eq`, justÁü¹NK like `HashMap` does, so that you can pass `&str` to lookup into a map withÁäˆ `String` keys and so on.Á¥© # ContractÁ¸©ü¼>; The implementor **must** hash like `K`, if it is hashable.ÁT…³“Þüû“ÞÝ üä&ü¡>; Compare self to `key` and return `true` if they are equal.ÁTç é Ý ò
éݱùüŽQÐ ³

“Þ× õ žÌ×ÊÛÝ××  359;üô% × Ý 
×ݱüö.¼Ï Key ordering trait.Áç©üëMJ This trait allows ordered map lookup to be customized. It has one blanketÁü¹OL implementation that uses the regular solution with `Borrow` and `Ord`, justÁü‰OL like `BTreeMap` does, so that you can pass `&str` to lookup into a map withÁäÙªT€ ³

 áüöéÝl—õ  °&°&"#%üä'ü«41 Compare self to `key` and return their ordering.Á<ç é ÝÇ  ï
éݱöüRгÿ! õ Ÿì×Ë¥"L××(*.0üö& × ÝÇ 
×Ý$±<; þ^ Ž ûG ¢ææ¢æ ¢¯ L6Û±‰”╾øÍ˜K Ê24¬Š6/U@#v1¿ZtHBå
e7.†RõØ¡4}r ÿï‹ r