Conversation
No features required as crate only needs `core` and `alloc`
1.34 does not have access to `alloc`, 1.36 does
197g
left a comment
There was a problem hiding this comment.
One observation that this rework brought to attention: the way the data is shaped, I don't think any of the n.{b,g,r} in the network can actually be NaN and then neither can be their differences. I was initially concerned about performance (and still, might be nice to check with some examples) but really it may be possible to specialize some of the standard functions around the non-NaN property and win performance in that way if the optimizer can not proof the same already.
I experimented in Godbolt and confirmed that a large number of |
|
I've replaced the implementations in Doing so removes the performance boost that comes from |
Checking crates.io, there are only 5 listed dependents on All other dependents either list an MSRV above 1.34, or are on edition 2021/2024 (and thus incompatible with Rust 1.34). As such, I think the bump from Rust 1.34 to 1.36 should have zero impact on the crates.io ecosystem. If someone is affected by this, it can be easily mitigated by adding the following to their own [dependencies]
color_quant = "=1.1.0"This will peg them to the exact version that is last compatible with Rust 1.34. |
|
The MSRV bump is fine, and is in fact wildly more conservative than we've been using for any of the other image-rs crates. |
Objective
imageis going to gainno_stdsupport, it would be beneficial for its dependencies to also haveno_stdsupport.Solution
#![no_std]f64::absbased on the proven implementation fromnum_traitsand comments on this PR.f64::roundintoclampand combined them into a new methodclamp_round.alloccrate.Notes
Since this crate doesn't need
std, there's no need to add anstdfeature, making this PR suitable for a minor patch.