diff options
| author | Sean McArthur <sean.monstar@gmail.com> | 2015-05-06 15:53:53 -0700 |
|---|---|---|
| committer | Sean McArthur <sean.monstar@gmail.com> | 2015-05-08 17:13:54 -0700 |
| commit | 093ebd5a62d77678046b5e56420d46df37a97129 (patch) | |
| tree | b0624c7efe3c5c6cf89936c7859d8f97ab6462a1 | |
| parent | aaa3641754543d6891c872e3be6667cfbec7b741 (diff) | |
| download | rust-093ebd5a62d77678046b5e56420d46df37a97129.tar.gz rust-093ebd5a62d77678046b5e56420d46df37a97129.zip | |
collections: impl AsRef<[u8]> for String
| -rw-r--r-- | src/libcollections/string.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 3c668f7fe9b..52d72501b4a 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -1058,6 +1058,14 @@ impl AsRef<str> for String { } #[stable(feature = "rust1", since = "1.0.0")] +impl AsRef<[u8]> for String { + #[inline] + fn as_ref(&self) -> &[u8] { + self.as_bytes() + } +} + +#[stable(feature = "rust1", since = "1.0.0")] impl<'a> From<&'a str> for String { #[cfg(not(test))] #[inline] |
