From dcd1e7719b333233329da7a3d2b3bf5102ec104c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Mon, 14 Oct 2013 15:38:23 +0200 Subject: [PATCH] Add methods to access a DVec as a &[N]. --- src/structs/dvec.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/structs/dvec.rs b/src/structs/dvec.rs index ed9f7eff..08302f31 100644 --- a/src/structs/dvec.rs +++ b/src/structs/dvec.rs @@ -92,6 +92,20 @@ impl DVec { *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] pub fn to_vec(self) -> ~[N] { self.at