-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable use from no_std crates #92
Conversation
Unfortunately, this is a breaking change, for two reasons:
So there are problems here, but I think they can be solved. It's a little annoying to need 2.0 though -- do you have a motivating use case for this? If it's just "because we can", I'd say we shouldn't bother...
Yeah, style-wise I'd prefer to use |
|
||
pub mod collections { | ||
pub mod hash_map { | ||
pub use hashmap_core::map::*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized this changes our default RandomState
type, normally defined only in std
, which is also a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think hashmap_core should be dropped from this PR, because it only adds this, which we don't want.
We'd like to not have a default hasher, that should work, and not have IndexMap::new() at all when we are no-std.
IMHO we don't need to care about this. Because this crate has no default features to start with, we should not let ourselves be held hostage by those that configure like this. I.e |
Well FWIW, I got called out on default-features for num: rust-num/num#297 You could choose to write off such users, but #95 shows how to do it without features. |
Ok! I agree, #95 seems good and you've taken it in the right direction for sure. I just didn't understand the build script stuff (because it was not complete). |
This PR adds the ability to use this crate with
no_std
. It has no breaking changes, using a defaultstd
feature with an optionalcore
feature. SinceHashMap
is only included inlibstd
, it uses thehashmap_core
crate to replace it when compiling withno_std
.It may be cleaner to replace uses of
std
withcore
oralloc
, rather than creating a fakestd
. Please let me know if you'd prefer that.