indexmap-rs / indexmap

A hash table with consistent order and fast iteration; access items by key or sequence index
https://docs.rs/indexmap/
Other
1.67k stars 150 forks source link

Add an opt-in trait for "unstable" raw entries #300

Closed cuviper closed 7 months ago

cuviper commented 7 months ago

We usually wait for the standard library to stabilize APIs so we can match them as much as possible, but the future of raw entries in rust-lang/rust#56167 is uncertain. For folks who really want it now, this PR offers an opt-in trait RawEntryApiV1 without polluting our inherent method namespace.

The V1 suffix is basically representing a snapshot of what std currently has, as of Rust 1.75. If they later change in compatible ways, we can extend ours to keep up, or else we can consider a V2. If std finally stabilizes a raw entry API, we will match that in our inherent methods, without an intermediate trait. We won't be able to remove the old traits without a semver breaking change, but they can at least be #[deprecated].

Resolves #166.