no_std support
richardanaya opened this issue · 2 comments
Having no_std support would lend this library into web assembly projects better. Some of the standard libraries end up being quite huge in wasm.
Sounds good to me.
Here's a list of everything that would be needed for no_std
support. Should be fairly quick since rectangle-pack
is fairly small.
I'm not sure when I will get to this - but in the meantime, if you need this quickly, feel free to PR some or all of these steps and I can get them merged.
-
Remove all HashMap usage in favor of BTreeMap
- This adds some additional runtime cost, but until someone has a use case where they need to pack rectangles at top speed this is fine for now. In the future, if necessary, we could expose a feature flag to pull in a no_std compatible hash map implementation.
-
Add feature flag
[features] default = ["std"] std = []
-
Use Rust's core crate instead of std
-
Use Rust's alloc crate instead of std
#[macro_use] extern crate alloc;
-
Replace
PathBuf
with&'static str
in thedeterministic_packing
test case -
Enable
#![no_std]
when the std feature is disabled -
Test both std and no_std in CI
-
Release a new patch version