We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
[T; N]::as_[mut_]slice
1 parent 85fbf49 commit 104a023Copy full SHA for 104a023
library/core/src/array/mod.rs
@@ -422,4 +422,17 @@ impl<T, const N: usize> [T; N] {
422
// and we just need to cast it to the correct type.
423
unsafe { crate::mem::transmute_copy::<_, [U; N]>(&dst) }
424
}
425
+
426
+ /// Returns a slice containing the entire array. Equivalent to `&s[..]`.
427
+ #[unstable(feature = "array_methods", issue = "76118")]
428
+ pub fn as_slice(&self) -> &[T] {
429
+ self
430
+ }
431
432
+ /// Returns a mutable slice containing the entire array. Equivalent to
433
+ /// `&mut s[..]`.
434
435
+ pub fn as_mut_slice(&mut self) -> &mut [T] {
436
437
438
0 commit comments