diff options
Diffstat (limited to 'src/libcollections/string.rs')
| -rw-r--r-- | src/libcollections/string.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 2adece30307..aa78db684af 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -364,6 +364,14 @@ impl String { self.vec } + /// Extract a string slice containing the entire string. + #[inline] + #[unstable(feature = "convert", + reason = "waiting on RFC revision")] + pub fn as_str(&self) -> &str { + self + } + /// Pushes the given string onto this string buffer. /// /// # Examples @@ -848,7 +856,6 @@ impl<'a, 'b> PartialEq<Cow<'a, str>> for &'b str { #[allow(deprecated)] impl Str for String { #[inline] - #[stable(feature = "rust1", since = "1.0.0")] fn as_slice(&self) -> &str { unsafe { mem::transmute(&*self.vec) } } |
