Replies: 1 comment
-
Hi, they are implemented for float via a blanket implementation for anything real-ish: impl<T> Stimulus for T
where
T: Real + One + Zero,
{
#[inline]
fn max_intensity() -> Self {
Self::one()
}
} You can see it at the bottom of this page: https://docs.rs/palette/0.7.3/palette/stimulus/trait.Stimulus.html. Your example should work fine if you need to convert the values from one type to another. Another change since 0.5 is that It may also be worth looking through the release announcements, if you haven't. They highlight most of the major changes:
I hope this was the answer you were looking for. Don't hesitate to ask about anything else that you encounter! |
Beta Was this translation helpful? Give feedback.
-
I recently started working on a codebase that used 0.5 and I'm going through and updating the dependencies, but I'm having trouble understanding the upgrade path from 0.5 -> 0.7.
The
Component
trait was implemented for float and integer types, but now theStimulus
trait appears to only be implemented for integer types. If I previously had an interface like this:Would the new interface look like this?
Does this mean that color types can no longer hold floats?
Beta Was this translation helpful? Give feedback.
All reactions