RawTable<usize> instead of
HashSet<usize> in its core implementation.
Then I checked
hashbrown and there is no documentation on when
RawTable should be used. I guess it's because the core implementation of
indexmap is independent with hash state, as is
HashSet is not?
RawTable says it
with an unsafe API, does that literally mean it includes some extra unsafe methods, or does it include its equivalent to the general
HashSet methods as well with extra places to look out for?
indexmap does that because the actual keys are stored outside of the table.
HashSet<usize> wouldn't work because there's no way to search that for a
String key, for example. Using a
RawTable<usize> offers callbacks that we can use to lookup the keys in the entries
There is another question related to
uses (literially) the HashMap implementation of
hashbrown. Then std, as a crate, should use
hashbrown crate as a dependency. At this point then introduce
hashbrown crate, according to the rules of cargo, there should be no additional code added to the final binary. Is this actually the case? I'm actually surprised that std can contain a "third-party" crate itself.
std is prebuilt and distributed as part of the rust toolchain. If you use
hashbrown as a dependency it will still be pulled in and built by cargo just like any other crate.
Cargo doesn't know about those internal-dependency crates, so it resolves your dependency independently and builds that with a different mangling hash. You can actually try to use the
hashbrown that's in the sysroot if you declare
extern crate hashbrown; without any dependency in your
Cargo.toml, but you'll get an error that this is an unstable location. On nightly, you can forge ahead anyway with
#![feature(rustc_private)], but there is no support if anything breaks there.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.