Is there a way to only include a dependency or only enable certain dependency features when a feature is not enabled?
I made this PR in the
eskf repo to fix the broken
no_std compatibility. The issue is the library depends on
nalgebra and to make it work on
no_std you need to disabled the default
std feature, enable the
libm feature and include the
num-traits crate (and do a conditional import). I only want to include these dependencies/features when using in a
no_std environment because they are not needed in a
std environment and they introduce some conflicting imports in one of the dependencies. The only solution I could think of was to add a
no_std feature but this goes against the standard practice to only have a
std feature (enabled by default) that you disable to make the crate
no_std compatible. In this case that won't work. Is there another way to do this?
Another question that came up in the PR is how to create an automated way to test for
no_std compatibility. I found
cargo-nono but this doesn't
cargo build or
cargo check the code so it relies on all the dependencies not breaking their own
no_std compatibility to work correctly. Another option is to run
cargo check with a target triple that doesn't support
std but how do you do that in a project that has examples that depend on
These have to be fairly common issues but I wasn't able to find much discussion about them. Hopefully I missed something. Thanks.