Skip to content

Commit 1ec4142

Browse files
committed
DOC: Add note to array view into_slice methods
1 parent ca691c5 commit 1ec4142

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/impl_views/conversions.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ where
3131

3232
/// Return the array’s data as a slice, if it is contiguous and in standard order.
3333
/// Return `None` otherwise.
34+
///
35+
/// Note that while the method is similar to [`ArrayBase::as_slice()`], this method tranfers
36+
/// the view's lifetime to the slice, so it is a bit more powerful.
3437
#[allow(clippy::wrong_self_convention)]
3538
pub fn into_slice(&self) -> Option<&'a [A]> {
3639
if self.is_standard_layout() {
@@ -116,6 +119,9 @@ where
116119
{
117120
/// Return the array’s data as a slice, if it is contiguous and in standard order.
118121
/// Return `None` otherwise.
122+
///
123+
/// Note that while this is similar to [`ArrayBase::as_slice_mut()`], this method tranfers the
124+
/// view's lifetime to the slice.
119125
pub fn into_slice(self) -> Option<&'a mut [A]> {
120126
self.into_slice_().ok()
121127
}

0 commit comments

Comments
 (0)