Skip to content

Commit

Permalink
Merge pull request #1017 from jturner314/doc-unsharing
Browse files Browse the repository at this point in the history
Document 'unsharing' in as_mut_ptr and raw_view_mut
  • Loading branch information
bluss authored Jun 5, 2021
2 parents 35e9ca2 + b956dbc commit 1daff26
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/impl_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1446,6 +1446,15 @@ where
}

/// Return a mutable pointer to the first element in the array.
///
/// This method attempts to unshare the data. If `S: DataMut`, then the
/// data is guaranteed to be uniquely held on return.
///
/// # Warning
///
/// When accessing elements through this pointer, make sure to use strides
/// obtained *after* calling this method, since the process of unsharing
/// the data may change the strides.
#[inline(always)]
pub fn as_mut_ptr(&mut self) -> *mut A
where
Expand All @@ -1462,6 +1471,9 @@ where
}

/// Return a raw mutable view of the array.
///
/// This method attempts to unshare the data. If `S: DataMut`, then the
/// data is guaranteed to be uniquely held on return.
#[inline]
pub fn raw_view_mut(&mut self) -> RawArrayViewMut<A, D>
where
Expand Down

0 comments on commit 1daff26

Please sign in to comment.