-
Notifications
You must be signed in to change notification settings - Fork 43
Support no_std #18
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
Comments
Thanks for the write-up! I think the hardest part will be writing the On POSIX, we can use As for Windows: there is a non-allocating UTF-16 decoder in the standard library, but it's in the unstable There is also the question of whether it's efficient to write the message one character at a time, which is what a naïve implementation using |
At least for my niche case, I don't care about Display at all. In fact, I wouldn't have a use for it. I'm not entirely sure it's worth worrying about Display until someone that needs the errno crate with no_std actually needs it. Who knows, I might even end up being the only user of this crate with no_std. |
Add a "std" feature which is enabled by default, and enable `no_std` when it is not enabled. Disable all `Display` and `Debug` features in `no_std` mode. My specific use case for this is [rsix](https://crates.io/crates/rsix), which has a no_std branch, and which uses the `errno` crate in its `libc`-using backend. Fixes lambda-fairy#18.
Add a "std" feature which is enabled by default, and enable `no_std` when it is not enabled. Disable all `Display` and `Debug` features in `no_std` mode. My specific use case for this is [rsix](https://crates.io/crates/rsix), which has a no_std branch, and which uses the `errno` crate in its `libc`-using backend. Fixes #18.
There are multiple use cases for no_std, most of which have no use for errno. But a few use cases involving low-level code that can't use libstd can still use e.g. libc. No libstd means no std::io, which means no errno from there.
Those use cases could be considered niches, and I would totally understand that a small crate for a couple uses in the entire rust ecosystem might not be worth. Being at the beginning of my project, I only need read access to errno, and have copy/pasted the relevant parts for that for now (and only the unix parts for prototyping purposes), but I will eventually need cross-platform and write access as well. To give you an idea how niche my own use case is: I'm reimplementing a malloc() library (namely, mozjemalloc, the allocator in use in Firefox) in rust.
The text was updated successfully, but these errors were encountered: