I'm trying to understand this indexset::BTreeMap::lower_bound method. I wrote some test code, but it won't work. I don't see why this bound
should be a problem.
let mut m = indexset::BTreeMap::new();
m.insert("apple", "a");
m.insert("banana", "b");
m.insert("blueberry", "b");
let bound = Bound::Included("apple");
let curs = m.lower_bound(bound);
It points at the last line, and complains that the key isn't Sized
.
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> learning/src/data_structures.rs:36:30
|
36 | let curs = m.lower_bound(bound);
| ----------- ^^^^^ doesn't have a size known at compile-time
| |
| required by a bound introduced by this call
|
= help: the trait `Sized` is not implemented for `str`
I flailed with some other variations, like:
let bound = Bound::Included("apple".to_owned());
let bound = Bound::Included(&"apple".to_owned());
They don't work either.