Merge pull request #189 from sebcrozet/from_to_value

Implement From returning a value (instead of a ref only) for matrices and vectors.
This commit is contained in:
Sébastien Crozet 2016-04-19 09:42:49 +02:00
commit a6cee5afc8
2 changed files with 16 additions and 0 deletions

View File

@ -50,6 +50,14 @@ macro_rules! conversion_impl(
}
}
}
impl<'a, N: Clone> From<&'a [[N; $dimension]; $dimension]> for $t<N> {
#[inline]
fn from(arr: &'a [[N; $dimension]; $dimension]) -> $t<N> {
let tref: &$t<N> = From::from(arr);
tref.clone()
}
}
)
);

View File

@ -51,6 +51,14 @@ macro_rules! conversion_impl(
}
}
}
impl<'a, N: Clone> From<&'a [N; $dimension]> for $t<N> {
#[inline]
fn from(arr: &'a [N; $dimension]) -> $t<N> {
let vref: &$t<N> = From::from(arr);
vref.clone()
}
}
)
);