cgmath
cgmath copied to clipboard
num::cast(5.0).unwrap() is ugly
As mentioned in #319, num::cast(5.0).unwrap()
is an ugly way for clients to construct generic literals. It might be worth exploring if cgmath can expose something nicer to authors of generic libraries.
So it seems like all floats support From<f32>
. This would allow for things like S::from(1.0)
.
Unfortunately the integer situation is more complex. All integers From<i8>
. All unsigned integers From<u8>
. But coming up with a nice common conversion is hard, which makes it difficult to support parameterising by unsigned integers :(