feat: add btree spec in vstd_extra - #704
Conversation
|
The |
|
|
| pub uninterp spec fn borrowed_key_ordering_matches<Key, Q: ?Sized>(key: &Q) -> bool; | ||
|
|
||
| /// The ordering of a stored key relative to a borrowed lookup key. | ||
| pub uninterp spec fn borrowed_key_cmp<Key, Q: ?Sized>(stored_key: Key, key: &Q) -> Ordering; |
There was a problem hiding this comment.
Why can we compare these two types?
There was a problem hiding this comment.
We do not directly compare Key with Q. The BTreeMap API requires Key: Borrow<Q> and Q: Ord, so the stored key is first borrowed as &Q, then compared with the lookup key using Q::cmp. borrowed_key_cmp abstracts stored_key.borrow().cmp(key) because vstd does not provide a general specification for Borrow::borrow.
No description provided.