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:34:44 +02:00
parent 847edafcfe
commit 13a5bee25f
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()
}
}
) )
); );