Struct canonical_path::CanonicalPath [] [src]

pub struct CanonicalPath(_);

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.

Methods

impl CanonicalPath
[src]

[src]

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

[src]

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

We utilize 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.

[src]

Convert a canonical path reference into an owned CanonicalPathBuf

[src]

Return a Path reference.

[src]

Return an OsStr reference.

[src]

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

[src]

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

[src]

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

[src]

Determines whether base is a prefix of self.

[src]

Determines whether child is a suffix of self.

[src]

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

[src]

Extracts the extension of self.file_name, if possible.

[src]

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

[src]

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

[src]

Produces an iterator over the Components of a path

[src]

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

[src]

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

[src]

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.

[src]

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

[src]

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.

[src]

Does this path exist?

[src]

Is this path a file?

[src]

Is this path a directory?

Trait Implementations

impl AsRef<CanonicalPath> for CanonicalPathBuf
[src]

[src]

Performs the conversion.

impl Borrow<CanonicalPath> for CanonicalPathBuf
[src]

[src]

Immutably borrows from an owned value. Read more

impl Debug for CanonicalPath
[src]

[src]

Formats the value using the given formatter. Read more

impl PartialOrd for CanonicalPath
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

[src]

This method tests less than (for self and other) and is used by the < operator. Read more

[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for CanonicalPath
[src]

[src]

This method returns an Ordering between self and other. Read more

1.21.0
[src]

Compares and returns the maximum of two values. Read more

1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl PartialEq for CanonicalPath
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Eq for CanonicalPath
[src]

impl Hash for CanonicalPath
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl AsRef<Path> for CanonicalPath
[src]

[src]

Performs the conversion.

impl ToOwned for CanonicalPath
[src]

[src]

Creates owned data from borrowed data, usually by cloning. Read more

[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Auto Trait Implementations

impl Send for CanonicalPath

impl Sync for CanonicalPath