Files
boc/aamos-ledger-rust/target/release/deps/libequivalent-4a285f80be49dab1.rlib
T

26 lines
9.5 KiB
Plaintext
Raw Normal View History

!<arch>
/ 0 0 0 0 8 `
// 70 `
equivalent-4a285f80be49dab1.equivalent.ec9161a590fa1164-cgu.0.rcgu.o/
lib.rmeta/ 0 0 0 644 8784 `
ELF·Ð @@GNUÀrust
œ#rustc 1.96.0 (ac68faa20 2026-05-25)ÁíàÄTËŸ ÜJîÄ)'ß\¥!-3d1337db07d0b3aeÁ¤°ð ¾ä-±($²ï=©Ã-7e98a21bfd32b0edÁí
EquivalentÁœ
equivalentÁ¢œº
ComparableÁ œ compareÁ¢œü







 ¢œ ÅË d¸
¢ËŸü¤!-
·ßÅÅP,Ë üôW$• Å,‚ ËïkeyÁ"QúǨ Ùúä§ý
»ÅC'ÉüöS¿ßÀßÁßLessÁÂßÃßÄß~Å߯ßÇßGreaterÁÈßåºÝÈnûê7D”ï,ûˆïéž©úøô íY4Ü ®¿ßüËü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));Áü·