Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document 'unsharing' in as_mut_ptr and raw_view_mut #1017

Merged
merged 1 commit into from Jun 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/impl_methods.rs
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