Add impl From<i16> for angle and length
This commit is contained in:
parent
e0926a00f7
commit
009f896e08
@ -23,6 +23,14 @@ pub struct Angle<T: Default> {
|
|||||||
value: AngleUnit<T>,
|
value: AngleUnit<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T: From<i16> + Default> From<i16> for Angle<T> {
|
||||||
|
fn from(i: i16) -> Self {
|
||||||
|
Self {
|
||||||
|
value: AngleUnit::Degrees(T::from(i)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<T: Default + Clone + Rem<T, Output = T>> Rem<T> for Angle<T> {
|
impl<T: Default + Clone + Rem<T, Output = T>> Rem<T> for Angle<T> {
|
||||||
type Output = Self;
|
type Output = Self;
|
||||||
|
|
||||||
|
|||||||
@ -4,3 +4,9 @@ use super::Precision;
|
|||||||
|
|
||||||
#[derive(Inspectable, Default, Copy, Clone, Debug)]
|
#[derive(Inspectable, Default, Copy, Clone, Debug)]
|
||||||
pub struct Length(pub Precision);
|
pub struct Length(pub Precision);
|
||||||
|
|
||||||
|
impl From<i16> for Length {
|
||||||
|
fn from(i: i16) -> Self {
|
||||||
|
Self(Precision::from(i))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user