Rename VecStorage::data/data_mut to ::as_vec/as_vec_mut
This commit is contained in:
parent
664658760a
commit
f52bd4be3d
|
@ -270,7 +270,7 @@ where DefaultAllocator: Allocator<N, R, C>
|
||||||
/// let vec_ptr = vec.as_ptr();
|
/// let vec_ptr = vec.as_ptr();
|
||||||
///
|
///
|
||||||
/// let matrix = Matrix::from_vec_generic(Dynamic::new(vec.len()), U1, vec);
|
/// 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.
|
/// // `matrix` is backed by exactly the same `Vec` as it was constructed from.
|
||||||
/// assert_eq!(matrix_storage_ptr, vec_ptr);
|
/// assert_eq!(matrix_storage_ptr, vec_ptr);
|
||||||
|
|
|
@ -50,15 +50,16 @@ impl<N, R: Dim, C: Dim> VecStorage<N, R, C> {
|
||||||
|
|
||||||
/// The underlying data storage.
|
/// The underlying data storage.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn data(&self) -> &Vec<N> {
|
pub fn as_vec(&self) -> &Vec<N> {
|
||||||
&self.data
|
&self.data
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The underlying mutable data storage.
|
/// 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]
|
#[inline]
|
||||||
pub unsafe fn data_mut(&mut self) -> &mut Vec<N> {
|
pub unsafe fn as_vec_mut(&mut self) -> &mut Vec<N> {
|
||||||
&mut self.data
|
&mut self.data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue