提交 aaa36417 编写于 作者: S Sean McArthur

core: impl AsRef<[u8]> for str

上级 e6378cbd
......@@ -21,6 +21,7 @@
use char::CharExt;
use clone::Clone;
use cmp::{self, Eq};
use convert::AsRef;
use default::Default;
use fmt;
use iter::ExactSizeIterator;
......@@ -1842,6 +1843,14 @@ fn is_empty(&self) -> bool { self.len() == 0 }
fn parse<T: FromStr>(&self) -> Result<T, T::Err> { FromStr::from_str(self) }
}
#[stable(feature = "rust1", since = "1.0.0")]
impl AsRef<[u8]> for str {
#[inline]
fn as_ref(&self) -> &[u8] {
self.as_bytes()
}
}
/// Pluck a code point out of a UTF-8-like byte slice and return the
/// index of the next code point.
#[inline]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册