mirror of
https://github.com/openharmony/third_party_rust_indexmap.git
synced 2026-07-18 16:04:29 -04:00
b830148a9d
```rust
where
IndexMap<K, V, S>: IndexMut<usize, Output = V>,
IndexSet<T, S>: Index<usize, Output = T>,
```
This allows `map[i]` and `set[i]` indexing to access values directly,
panicking if the index is out of bounds, similar to slices.
On maps, this somewhat overlaps with `Index<&Q> + IndexMut<&Q>` where
`Q: Equivalent<K>`. The reference makes this indexing unambiguous, but
it could be confusing to users if the key type is also an integer.