Add methods to access a DVec<N> as a &[N].
This commit is contained in:
parent
bb5654d220
commit
dcd1e7719b
|
@ -92,6 +92,20 @@ impl<N> DVec<N> {
|
||||||
*self.at.unsafe_mut_ref(i) = val
|
*self.at.unsafe_mut_ref(i) = val
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn as_vec<'r>(&'r self) -> &'r [N] {
|
||||||
|
let data: &'r [N] = self.at;
|
||||||
|
|
||||||
|
data
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn as_mut_vec<'r>(&'r mut self) -> &'r mut [N] {
|
||||||
|
let data: &'r mut [N] = self.at;
|
||||||
|
|
||||||
|
data
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_vec(self) -> ~[N] {
|
pub fn to_vec(self) -> ~[N] {
|
||||||
self.at
|
self.at
|
||||||
|
|
Loading…
Reference in New Issue