I’m currently making a library that needs to work without the standard library but can provide more features by using it.
I see two solutions to this, and I’m split between which of them I like the best. I appreciate all insight you might have regarding this subject.
Implement the set of the functionality working with no_std in a “core crate” and extend the functionality with a new crate depending on the original crate.
- This might require the no_std crate to export things otherwise not required.
- Should the crate using std re-export the no_std crate?
Having an std [feature] in the crate and using #![cfg_attr(not(feature=“std”), no_std)] instead of #![no_std] in the original crate. Then using conditional compilation to decide what should be compiled.
- How will this work with the documentation generated at crates.io?
- What does this mean for testing? cargo test --feature “std” should be added to the CI tool?
Some better alternative that I haven’t thought about.
Are there any other projects I can look to for inspiration?
To satisfy any curiosity, I’m currently implementing the Uavcan protocol in Rust.