提交 db2f308a 编写于 作者: N Nick Hamann

Add two examples for Path::new

上级 f46c4e15
......@@ -1248,6 +1248,13 @@ fn as_u8_slice(&self) -> &[u8] {
/// use std::path::Path;
///
/// Path::new("foo.txt");
///
/// // Strings work too
/// let s = String::from("bar.txt");
/// let p = Path::new(&s);
///
/// // As do other Paths
/// Path::new(&p);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn new<S: AsRef<OsStr> + ?Sized>(s: &S) -> &Path {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册