-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
The current API implementation does not support deref coercion like the standard Rust collections. In some cases, this forces a redundant instantiation only for retrieving data. E.g.:
#[test]
fn should_allow_retrieving_with_deref_types() {
let mem = make_memory();
let mut btree: BTreeMap<String, u64, _> = BTreeMap::new(mem.clone());
btree.insert("foo".to_string(), 42);
// This one works but it forces a useless instantiation of a new String
assert_eq!(btree.get(&"foo".to_string()), Some(42)); // OK
// This does not compile because the API strictly expects a `&String` type
assert_eq!(btree.get("foo"), Some(42));
}Metadata
Metadata
Assignees
Labels
No labels