Skip to content

Commit 1daff26

Browse files
authored
Merge pull request #1017 from jturner314/doc-unsharing
Document 'unsharing' in as_mut_ptr and raw_view_mut
2 parents 35e9ca2 + b956dbc commit 1daff26

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/impl_methods.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,6 +1446,15 @@ where
14461446
}
14471447

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

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

0 commit comments

Comments
 (0)