-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement From trait #58
Comments
May require specialization. May require RFC 1834. I don't think there is a way to constrain impl<D, Ul, Ur, V> $crate::lib::convert::From<Quantity<D, Ur, V>> for Quantity<D, Ul, V>
where
D: Dimension + ?Sized,
Ul: Units<V> + ?Sized,
Ur: Units<V> + ?Sized,
V: $crate::num::Num + $crate::Conversion<V>,
{
fn from (t: Quantity<D, Ur, V>) -> Quantity<D, Ul, V> {
Quantity {
dimension: $crate::lib::marker::PhantomData,
units: $crate::lib::marker::PhantomData,
value: change_base::<D, Ul, Ur, V>(&t.value)
}
}
}
|
I also would love to see, simple though it is, an |
|
Definitely agree with the above two comments. Shall I put together a PR? |
I'd love that; I totally forgot to implement this! I'd be happy to help if you hit any roadblocks, as well. |
I am indeed hitting a roadblock; I don't know a good-enough way to convert a Time into a number of seconds. |
I’ll take a look at your work later tonight or tomorrow and see if I can’t help out. |
impl<D, Ul, Ur, V> From<Quantity<D, Ur, V>> for Quantity<D, Ul, V> ...
Allow for explicit conversion between quantities with different base units.
The text was updated successfully, but these errors were encountered: