Struct std::path::posix::Path[src]
pub struct Path {
// some fields omitted
}Represents a POSIX file path
Methods
impl Path
fn stat(&self) -> IoResult<FileStat>
Get information on the file, directory, etc at this path.
Consult the fs::stat documentation for more info.
This call preserves identical runtime/error semantics with file::stat.
fn lstat(&self) -> IoResult<FileStat>
Get information on the file, directory, etc at this path, not following symlinks.
Consult the fs::lstat documentation for more info.
This call preserves identical runtime/error semantics with file::lstat.
fn exists(&self) -> bool
Boolean value indicator whether the underlying file exists on the local
filesystem. Returns false in exactly the cases where fs::stat fails.
fn is_file(&self) -> bool
Whether the underlying implementation (be it a file path, or something else) points at a "regular file" on the FS. Will return false for paths to non-existent locations or directories or other non-regular files (named pipes, etc). Follows links when making this determination.
fn is_dir(&self) -> bool
Whether the underlying implementation (be it a file path, or something else) is pointing at a directory in the underlying FS. Will return false for paths to non-existent locations or if the item is not a directory (eg files, named pipes, etc). Follows links when making this determination.
impl Path
fn new<T: BytesContainer>(path: T) -> Path
Returns a new Path from a byte vector or string
Failure
Fails the task if the vector contains a NUL.
fn new_opt<T: BytesContainer>(path: T) -> Option<Path>
Returns a new Path from a byte vector or string, if possible
fn components<'a>(&'a self) -> Components<'a>
Returns an iterator that yields each component of the path in turn. Does not distinguish between absolute and relative paths, e.g. /a/b/c and a/b/c yield the same set of components. A path of "/" yields no components. A path of "." yields one component.
fn str_components<'a>(&'a self) -> StrComponents<'a>
Returns an iterator that yields each component of the path as Option<&str>. See components() for details.