Struct abscissa_core::path::AbsPath

source ·
pub struct AbsPath(_);
Expand description

A reference type for a canonical filesystem path

More specifically: it is at least guaranteed to be canonical at the time it is created. There are potential TOCTTOU problems if the underlying filesystem structure changes after path canonicalization.

Implementations§

Create a canonical path, returning error if the supplied path is not canonical

Create a canonical path from a path, skipping the canonicalization check

This uses the same unsafe reference conversion tricks as std to convert from AsRef<Path> to AsRef<CanonicalPath>, i.e. &CanonicalPath is a newtype for &Path in the same way &Path is a newtype for &OsStr.

Convert a canonical path reference into an owned CanonicalPathBuf

Return a Path reference.

Return an OsStr reference.

Yields a &str slice if the path is valid unicode.

Return a canonical parent path of this path, or io::Error if the path is the root directory or another canonicalization error occurs.

Returns the final component of the path, if there is one.

Determines whether base is a prefix of self.

Determines whether child is a suffix of self.

Extracts the stem (non-extension) portion of self.file_name.

Extracts the extension of self.file_name, if possible.

Creates an owned CanonicalPathBuf like self but with the given file name.

Creates an owned CanonicalPathBuf like self but with the given extension.

Produces an iterator over the Components of a path

Produces an iterator over the path’s components viewed as OsStr slices.

Returns an object that implements Display for safely printing paths that may contain non-Unicode data.

Queries the file system to get information about a file, directory, etc.

Unlike the std version of this method, it will not follow symlinks, since as a canonical path we should be symlink-free.

Join a path onto a canonical path, returning a CanonicalPathBuf.

Returns an iterator over the entries within a directory.

The iterator will yield instances of io::Result. New errors may be encountered after an iterator is initially constructed.

This is an alias to fs::read_dir.

Does this path exist?

Is this path a file?

Is this path a directory?

Trait Implementations§

Converts this type into a shared reference of the (usually inferred) input type.
Converts this type into a shared reference of the (usually inferred) input type.
Immutably borrows from an owned value. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more