Open ChocolateLoverRaj opened 3 weeks ago
Hi! Many floating point functions need a library implementation and that's usually provided by std
. When disabling std
, you can enable the "libm"
feature, as shown in the readme example:
[dependencies.palette]
version = "0.7.6"
default-features = false
features = ["libm"] # Uses libm instead of std for floating point math
The corresponding argument to cargo build
would be --features libm
.
Thanks, that fixed it. I think the fact that libm
is required for no_std should be added to the docs. Or maybe there should be a feature called no_std
which activates the libm
feature.
I suppose it could be added to the getting started part of the crate root docs too. :thinking: Was that where you were looking?
Was that where you were looking?
Yes. I also looked in the list of features to see if there was a no_std feature.
I see, thanks. A no_std
feature tends to be an anti-pattern, as it's a "negative feature". I'm happy to clarify things, though. The section at https://crates.io/crates/palette could perhaps highlight it more, for example. It's hard to see these things for me, who's familiar with it already.
I'd love a "crate features" section in the docs!
(feature flags are sadly imho a rather weak spot in Rust/cargo. You can't express mandatory sets of features/combinations apart from rolling your own with compile_error!
, and rustdoc doesn't parse feature comments in Cargo.toml
…)
Absolutely, that's also a possible improvement.
There are tons of errors when trying to build
palette
with--no-default-features
.How To Reproduce
cargo 1.82.0-nightly (2f738d617 2024-08-13)
andcargo 1.80.1 (376290515 2024-07-16)
cd palette
cargo b --no-default-features
Expected Outcome
Builds without errors
Actual Outcome
32 errors. Here is one of them:
Additional Details
I am trying to use palette on the
thumbv6m-none-eabi
target. I am trying to use palette to control the onboard RGB LED on a RP2040 Zero.cargo 1.82.0-nightly (2f738d617 2024-08-13)
andcargo 1.80.1 (376290515 2024-07-16)
--target some-platform
argument when cross compiling -->x86_64-unknown-linux-gnu
andthumbv6m-none-eabi