2
0
Fork 1
mirror of https://github.com/async-rs/async-std.git synced 2025-03-31 13:36:41 +00:00

Implemented Path::display

This commit is contained in:
Wouter Geraedts 2019-10-13 18:56:26 +02:00
parent 759e357bea
commit 5235cd58be

View file

@ -1,6 +1,6 @@
use std::ffi::OsStr;
use crate::path::{Ancestors, Components, PathBuf};
use crate::path::{Ancestors, Components, Display, PathBuf};
use crate::{fs, io};
/// This struct is an async version of [`std::path::Path`].
@ -106,6 +106,24 @@ impl Path {
self.inner.components()
}
/// Returns an object that implements [`Display`] for safely printing paths
/// that may contain non-Unicode data.
///
/// [`Display`]: https://doc.rust-lang.org/std/fmt/trait.Display.html
///
/// # Examples
///
/// ```
/// use async_std::path::Path;
///
/// let path = Path::new("/tmp/foo.rs");
///
/// println!("{}", path.display());
/// ```
pub fn display(&self) -> Display<'_> {
self.inner.display()
}
/// Returns `true` if the path points at an existing entity.
///
/// This function will traverse symbolic links to query information about the