Easy component type conversion, between mint types
lo48576 opened this issue · 2 comments
I think people (including me) sometimes want to convert f64
types and f32
types or such component type conversion.
For example, downgrading Point3<f64>
to Point3<f32>
.
These conversions cannot be written using only From
and Into
trait (because of coherence), so usually it is done by .map()
function.
(See Option::map
and Result::map
for example.)
I'm not sure how this should be implemented in this crate, .map()
method, Map
trait, or something else...
Are these component type conversion in scope of this crate?
FYI: rgb
crate has ComponentMap
trait to do that.
It sounds fairly straightforward: the feature is generic, doesn't involve any math specifically, and can be implemented with just a few blocks. I think we could have it in scope.
As for ComponentMap
, it's a pretty solution but it doesn't appear to be providing a lot of benefit to mint
since our types don't have any methods that would be confusingly conflict with map
.