mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-11 15:23:05 +00:00
Partially stabilize array_methods
This also makes `<[T; N]>::as_slice` const due to its trivial nature.
This commit is contained in:
parent
76e755cf4a
commit
905c2ba5f8
@ -368,14 +368,14 @@ impl<T, const N: usize> [T; N] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a slice containing the entire array. Equivalent to `&s[..]`.
|
/// Returns a slice containing the entire array. Equivalent to `&s[..]`.
|
||||||
#[unstable(feature = "array_methods", issue = "76118")]
|
#[stable(feature = "array_as_slice", since = "1.57.0")]
|
||||||
pub fn as_slice(&self) -> &[T] {
|
pub const fn as_slice(&self) -> &[T] {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a mutable slice containing the entire array. Equivalent to
|
/// Returns a mutable slice containing the entire array. Equivalent to
|
||||||
/// `&mut s[..]`.
|
/// `&mut s[..]`.
|
||||||
#[unstable(feature = "array_methods", issue = "76118")]
|
#[stable(feature = "array_as_slice", since = "1.57.0")]
|
||||||
pub fn as_mut_slice(&mut self) -> &mut [T] {
|
pub fn as_mut_slice(&mut self) -> &mut [T] {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user