-
Notifications
You must be signed in to change notification settings - Fork 323
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
NO_STD #370
base: master
Are you sure you want to change the base?
NO_STD #370
Conversation
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 am not sure use crate::lib::*;
is a good practice. The idea to wrap everything is good, but probably better to import only used modules. Please also add the corresponding CI job from #238
Also CI is failing:
|
Should all test be included in no_std? this will require some additional work |
Yes. |
Maybe leave thoose tests that uses RNG outside of |
Yes, that makes sense. |
I have implemented requested changes, all tests are passing in both std and no_std |
Looks better, thanks! |
@XVilka |
@zendurix you can just take |
Also I am not sure, instead of adding By the way, you can also use https://github.com/hobofan/cargo-nono for checks. |
I can think of smth like
But I am not very good with macros, and I am not sure how to do this |
Maybe something like macro_rules! no_std_println {
($(t:tt)*) => {
#[cfg(feature = "std")]
{
println!($($t)*);
}
};
} |
I see problems with CI (cause old PR have feature no_std) I will impl this macro and fix CI later today |
@zendurix have you had any luck with this update? Could you please rebase because we migrated from Travis CI to GitHub Actions? |
@zendurix could you please rebase your PR? |
#[cfg(feature = "std")] | ||
pub use std::collections::{hash_map::Entry::{Occupied, Vacant}, HashSet, hash_map::Iter}; | ||
#[cfg(not(feature = "std"))] | ||
pub use hashbrown::{ HashSet, hash_map::{ HashMap, Entry::{Occupied, Vacant}, Iter}}; |
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.
HashMap is used in the public API - this PR would mean that public API changes breakingly based on a cargo feature, and that's not an allowed usage of cargo features in general. This can't be integrated with this design, unfortunately.
The whole approach to HashMap needs to change somehow. I don't know if using hashbrown is necessary. Keep it simple and incremental, is it possible to support compiling without HashMap?
Hi, this is such a wonderful job. Is there any plan that the rebase can be done in the near future? |
0.7.0 will have no-std support, until this version has landed I will keep this PR open. |
I have succesfully implemented no_std with hasbrown crate (to enable no_std use with default-features = false
It passed no_std check (https://github.com/mystor/cargo-no-std-check)