提交 cf3d6b56 编写于 作者: T Tshepang Lekhonkhobe

doc: improve as_path example

上级 74728862
......@@ -632,9 +632,11 @@ fn is_sep_byte(&self, b: u8) -> bool {
/// ```
/// use std::path::Path;
///
/// let path = Path::new("/tmp/foo/bar.txt");
/// let mut components = Path::new("/tmp/foo/bar.txt").components();
/// components.next();
/// components.next();
///
/// println!("{:?}", path.components().as_path());
/// assert_eq!(Path::new("foo/bar.txt"), components.as_path());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn as_path(&self) -> &'a Path {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册