diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-03-30 20:18:16 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-03-30 20:18:16 +0530 |
| commit | 3b4547010011b948168d64eb8d05a5cfa7652765 (patch) | |
| tree | d3e133c446a8aab157f145122223c7d2ab944dc1 /src/libcore/array.rs | |
| parent | db50084cd9d83f7b342f481c2d03f78b50d99059 (diff) | |
| parent | d9252bde18360e5815f0d83a83efd597bc6bb5b7 (diff) | |
| download | rust-3b4547010011b948168d64eb8d05a5cfa7652765.tar.gz rust-3b4547010011b948168d64eb8d05a5cfa7652765.zip | |
Rollup merge of #23855 - tshepang:doc-nit, r=Manishearth
Diffstat (limited to 'src/libcore/array.rs')
| -rw-r--r-- | src/libcore/array.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libcore/array.rs b/src/libcore/array.rs index b2c23f051d5..91301ee558c 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -18,6 +18,7 @@ use clone::Clone; use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering}; +use convert::{AsRef, AsMut}; use fmt; use hash::{Hash, self}; use iter::IntoIterator; @@ -53,6 +54,24 @@ macro_rules! array_impls { } } + #[unstable(feature = "array_as_ref", + reason = "should ideally be implemented for all fixed-sized arrays")] + impl<T> AsRef<[T]> for [T; $N] { + #[inline] + fn as_ref(&self) -> &[T] { + &self[..] + } + } + + #[unstable(feature = "array_as_ref", + reason = "should ideally be implemented for all fixed-sized arrays")] + impl<T> AsMut<[T]> for [T; $N] { + #[inline] + fn as_mut(&mut self) -> &mut [T] { + &mut self[..] + } + } + #[stable(feature = "rust1", since = "1.0.0")] impl<T:Copy> Clone for [T; $N] { fn clone(&self) -> [T; $N] { |
