Skip to content

Commit

Permalink
Rename get_ptr_mut to get_mut_ptr to be more consistent with the as_m…
Browse files Browse the repository at this point in the history
…ut_ptr method.
  • Loading branch information
adamreichold authored and jturner314 committed Jul 30, 2022
1 parent 2f0b37b commit eb50663
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/impl_methods.rs
Expand Up @@ -768,7 +768,7 @@ where
S: DataMut,
I: NdIndex<D>,
{
unsafe { self.get_ptr_mut(index).map(|ptr| &mut *ptr) }
unsafe { self.get_mut_ptr(index).map(|ptr| &mut *ptr) }
}

/// Return a raw pointer to the element at `index`, or return `None`
Expand All @@ -780,15 +780,15 @@ where
/// let mut a = arr2(&[[1., 2.], [3., 4.]]);
///
/// let v = a.raw_view_mut();
/// let p = a.get_ptr_mut((0, 1)).unwrap();
/// let p = a.get_mut_ptr((0, 1)).unwrap();
///
/// unsafe {
/// *p = 5.;
/// }
///
/// assert_eq!(a.get((0, 1)), Some(&5.));
/// ```
pub fn get_ptr_mut<I>(&mut self, index: I) -> Option<*mut A>
pub fn get_mut_ptr<I>(&mut self, index: I) -> Option<*mut A>
where
S: RawDataMut,
I: NdIndex<D>,
Expand Down
4 changes: 2 additions & 2 deletions src/impl_views/indexing.rs
Expand Up @@ -164,7 +164,7 @@ where
fn index(mut self, index: I) -> &'a mut A {
debug_bounds_check!(self, index);
unsafe {
match self.get_ptr_mut(index) {
match self.get_mut_ptr(index) {
Some(ptr) => &mut *ptr,
None => array_out_of_bounds(),
}
Expand All @@ -182,7 +182,7 @@ where
fn get(mut self, index: I) -> Option<&'a mut A> {
debug_bounds_check!(self, index);
unsafe {
match self.get_ptr_mut(index) {
match self.get_mut_ptr(index) {
Some(ptr) => Some(&mut *ptr),
None => None,
}
Expand Down

0 comments on commit eb50663

Please sign in to comment.