From f52bd4be3dc0039f311cdf566db0a3ff1d112a1f Mon Sep 17 00:00:00 2001 From: sebcrozet Date: Sun, 3 Feb 2019 11:47:23 +0100 Subject: [PATCH] Rename VecStorage::data/data_mut to ::as_vec/as_vec_mut --- src/base/construction.rs | 2 +- src/base/vec_storage.rs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/base/construction.rs b/src/base/construction.rs index 05bb4b16..aeee6121 100644 --- a/src/base/construction.rs +++ b/src/base/construction.rs @@ -270,7 +270,7 @@ where DefaultAllocator: Allocator /// let vec_ptr = vec.as_ptr(); /// /// let matrix = Matrix::from_vec_generic(Dynamic::new(vec.len()), U1, vec); - /// let matrix_storage_ptr = matrix.data.as_ptr(); + /// let matrix_storage_ptr = matrix.data.as_vec().as_ptr(); /// /// // `matrix` is backed by exactly the same `Vec` as it was constructed from. /// assert_eq!(matrix_storage_ptr, vec_ptr); diff --git a/src/base/vec_storage.rs b/src/base/vec_storage.rs index 246c3515..4a852f25 100644 --- a/src/base/vec_storage.rs +++ b/src/base/vec_storage.rs @@ -50,15 +50,16 @@ impl VecStorage { /// The underlying data storage. #[inline] - pub fn data(&self) -> &Vec { + pub fn as_vec(&self) -> &Vec { &self.data } /// The underlying mutable data storage. /// - /// This is unsafe because this may cause UB if the vector is modified by the user. + /// This is unsafe because this may cause UB if the size of the vector is changed + /// by the user. #[inline] - pub unsafe fn data_mut(&mut self) -> &mut Vec { + pub unsafe fn as_vec_mut(&mut self) -> &mut Vec { &mut self.data }