Skip to content

Add as_slice and as_mut_slice to Option #92411

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

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Formatted rustdoc comments on Option's as_slice and as_mut_slice
  • Loading branch information
ChaiTRex committed Dec 29, 2021
commit 02d4462d292761cc26596334a7e6fdf333e87da0
18 changes: 10 additions & 8 deletions library/core/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,11 +694,12 @@ impl<T> Option<T> {
// Extracting slices
/////////////////////////////////////////////////////////////////////////

/// Extracts a slice that's empty if the option is a `None` value or
/// length one if the option is a `Some` value.
/// Extracts a slice that's empty if the option is a [`None`] value or
/// length one if the option is a [`Some`] value.
///
/// Note that the slice extracted from a None value does not necessarily
/// contain an internal pointer to anything associated with the option.
/// Note that the slice extracted from a [`None`] value does not
/// necessarily contain an internal pointer to anything associated with
/// the option.
///
/// # Examples
///
Expand All @@ -720,11 +721,12 @@ impl<T> Option<T> {
}
}

/// Extracts a mutable slice that's empty if the option is a `None` value
/// or length one if the option is a `Some` value.
/// Extracts a mutable slice that's empty if the option is a [`None`]
/// value or length one if the option is a [`Some`] value.
///
/// Note that the slice extracted from a None value does not necessarily
/// contain an internal pointer to anything associated with the option.
/// Note that the slice extracted from a [`None`] value does not
/// necessarily contain an internal pointer to anything associated with
/// the option.
///
/// # Examples
///
Expand Down