Struct ChildPath

Source
pub struct ChildPath { /* private fields */ }
Expand description

A path within a temporary directory.

§Examples

use camino_tempfile_ext::prelude::*;

let temp = Utf8TempDir::new().unwrap();

let input_file = temp.child("foo.txt");
input_file.touch().unwrap();

temp.child("bar.txt").touch().unwrap();

temp.close().unwrap();

Implementations§

Source§

impl ChildPath

Source

pub fn new<P: Into<Utf8PathBuf>>(path: P) -> Self

Wrap a path for use with extension traits.

See trait implementations or PathChild for more details.

Source

pub fn as_path(&self) -> &Utf8Path

Access the path.

Methods from Deref<Target = Utf8Path>§

pub fn as_std_path(&self) -> &Path

Converts a Utf8Path to a Path.

This is equivalent to the AsRef<&Path> for &Utf8Path impl, but may aid in type inference.

§Examples
use camino::Utf8Path;
use std::path::Path;

let utf8_path = Utf8Path::new("foo.txt");
let std_path: &Path = utf8_path.as_std_path();
assert_eq!(std_path.to_str(), Some("foo.txt"));

// Convert back to a Utf8Path.
let new_utf8_path = Utf8Path::from_path(std_path).unwrap();
assert_eq!(new_utf8_path, "foo.txt");

pub fn as_str(&self) -> &str

Yields the underlying str slice.

Unlike Path::to_str, this always returns a slice because the contents of a Utf8Path are guaranteed to be valid UTF-8.

§Examples
use camino::Utf8Path;

let s = Utf8Path::new("foo.txt").as_str();
assert_eq!(s, "foo.txt");

pub fn as_os_str(&self) -> &OsStr

Yields the underlying OsStr slice.

§Examples
use camino::Utf8Path;

let os_str = Utf8Path::new("foo.txt").as_os_str();
assert_eq!(os_str, std::ffi::OsStr::new("foo.txt"));

pub fn to_path_buf(&self) -> Utf8PathBuf

Converts a Utf8Path to an owned [Utf8PathBuf].

§Examples
use camino::{Utf8Path, Utf8PathBuf};

let path_buf = Utf8Path::new("foo.txt").to_path_buf();
assert_eq!(path_buf, Utf8PathBuf::from("foo.txt"));

pub fn is_absolute(&self) -> bool

Returns true if the Utf8Path is absolute, i.e., if it is independent of the current directory.

  • On Unix, a path is absolute if it starts with the root, so is_absolute and has_root are equivalent.

  • On Windows, a path is absolute if it has a prefix and starts with the root: c:\windows is absolute, while c:temp and \temp are not.

§Examples
use camino::Utf8Path;

assert!(!Utf8Path::new("foo.txt").is_absolute());

pub fn is_relative(&self) -> bool

Returns true if the Utf8Path is relative, i.e., not absolute.

See is_absolute’s documentation for more details.

§Examples
use camino::Utf8Path;

assert!(Utf8Path::new("foo.txt").is_relative());

pub fn has_root(&self) -> bool

Returns true if the Utf8Path has a root.

  • On Unix, a path has a root if it begins with /.

  • On Windows, a path has a root if it:

    • has no prefix and begins with a separator, e.g., \windows
    • has a prefix followed by a separator, e.g., c:\windows but not c:windows
    • has any non-disk prefix, e.g., \\server\share
§Examples
use camino::Utf8Path;

assert!(Utf8Path::new("/etc/passwd").has_root());

pub fn parent(&self) -> Option<&Utf8Path>

Returns the Path without its final component, if there is one.

Returns None if the path terminates in a root or prefix.

§Examples
use camino::Utf8Path;

let path = Utf8Path::new("/foo/bar");
let parent = path.parent().unwrap();
assert_eq!(parent, Utf8Path::new("/foo"));

let grand_parent = parent.parent().unwrap();
assert_eq!(grand_parent, Utf8Path::new("/"));
assert_eq!(grand_parent.parent(), None);

pub fn ancestors(&self) -> Utf8Ancestors<'_>

Produces an iterator over Utf8Path and its ancestors.

The iterator will yield the Utf8Path that is returned if the parent method is used zero or more times. That means, the iterator will yield &self, &self.parent().unwrap(), &self.parent().unwrap().parent().unwrap() and so on. If the parent method returns None, the iterator will do likewise. The iterator will always yield at least one value, namely &self.

§Examples
use camino::Utf8Path;

let mut ancestors = Utf8Path::new("/foo/bar").ancestors();
assert_eq!(ancestors.next(), Some(Utf8Path::new("/foo/bar")));
assert_eq!(ancestors.next(), Some(Utf8Path::new("/foo")));
assert_eq!(ancestors.next(), Some(Utf8Path::new("/")));
assert_eq!(ancestors.next(), None);

let mut ancestors = Utf8Path::new("../foo/bar").ancestors();
assert_eq!(ancestors.next(), Some(Utf8Path::new("../foo/bar")));
assert_eq!(ancestors.next(), Some(Utf8Path::new("../foo")));
assert_eq!(ancestors.next(), Some(Utf8Path::new("..")));
assert_eq!(ancestors.next(), Some(Utf8Path::new("")));
assert_eq!(ancestors.next(), None);

pub fn file_name(&self) -> Option<&str>

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

If the path is a normal file, this is the file name. If it’s the path of a directory, this is the directory name.

Returns None if the path terminates in ...

§Examples
use camino::Utf8Path;

assert_eq!(Some("bin"), Utf8Path::new("/usr/bin/").file_name());
assert_eq!(Some("foo.txt"), Utf8Path::new("tmp/foo.txt").file_name());
assert_eq!(Some("foo.txt"), Utf8Path::new("foo.txt/.").file_name());
assert_eq!(Some("foo.txt"), Utf8Path::new("foo.txt/.//").file_name());
assert_eq!(None, Utf8Path::new("foo.txt/..").file_name());
assert_eq!(None, Utf8Path::new("/").file_name());

pub fn strip_prefix( &self, base: impl AsRef<Path>, ) -> Result<&Utf8Path, StripPrefixError>

Returns a path that, when joined onto base, yields self.

§Errors

If base is not a prefix of self (i.e., starts_with returns false), returns Err.

§Examples
use camino::{Utf8Path, Utf8PathBuf};

let path = Utf8Path::new("/test/haha/foo.txt");

assert_eq!(path.strip_prefix("/"), Ok(Utf8Path::new("test/haha/foo.txt")));
assert_eq!(path.strip_prefix("/test"), Ok(Utf8Path::new("haha/foo.txt")));
assert_eq!(path.strip_prefix("/test/"), Ok(Utf8Path::new("haha/foo.txt")));
assert_eq!(path.strip_prefix("/test/haha/foo.txt"), Ok(Utf8Path::new("")));
assert_eq!(path.strip_prefix("/test/haha/foo.txt/"), Ok(Utf8Path::new("")));

assert!(path.strip_prefix("test").is_err());
assert!(path.strip_prefix("/haha").is_err());

let prefix = Utf8PathBuf::from("/test/");
assert_eq!(path.strip_prefix(prefix), Ok(Utf8Path::new("haha/foo.txt")));

pub fn starts_with(&self, base: impl AsRef<Path>) -> bool

Determines whether base is a prefix of self.

Only considers whole path components to match.

§Examples
use camino::Utf8Path;

let path = Utf8Path::new("/etc/passwd");

assert!(path.starts_with("/etc"));
assert!(path.starts_with("/etc/"));
assert!(path.starts_with("/etc/passwd"));
assert!(path.starts_with("/etc/passwd/")); // extra slash is okay
assert!(path.starts_with("/etc/passwd///")); // multiple extra slashes are okay

assert!(!path.starts_with("/e"));
assert!(!path.starts_with("/etc/passwd.txt"));

assert!(!Utf8Path::new("/etc/foo.rs").starts_with("/etc/foo"));

pub fn ends_with(&self, base: impl AsRef<Path>) -> bool

Determines whether child is a suffix of self.

Only considers whole path components to match.

§Examples
use camino::Utf8Path;

let path = Utf8Path::new("/etc/resolv.conf");

assert!(path.ends_with("resolv.conf"));
assert!(path.ends_with("etc/resolv.conf"));
assert!(path.ends_with("/etc/resolv.conf"));

assert!(!path.ends_with("/resolv.conf"));
assert!(!path.ends_with("conf")); // use .extension() instead

pub fn file_stem(&self) -> Option<&str>

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

The stem is:

  • None, if there is no file name;
  • The entire file name if there is no embedded .;
  • The entire file name if the file name begins with . and has no other .s within;
  • Otherwise, the portion of the file name before the final .
§Examples
use camino::Utf8Path;

assert_eq!("foo", Utf8Path::new("foo.rs").file_stem().unwrap());
assert_eq!("foo.tar", Utf8Path::new("foo.tar.gz").file_stem().unwrap());

pub fn extension(&self) -> Option<&str>

Extracts the extension of self.file_name, if possible.

The extension is:

  • None, if there is no file name;
  • None, if there is no embedded .;
  • None, if the file name begins with . and has no other .s within;
  • Otherwise, the portion of the file name after the final .
§Examples
use camino::Utf8Path;

assert_eq!("rs", Utf8Path::new("foo.rs").extension().unwrap());
assert_eq!("gz", Utf8Path::new("foo.tar.gz").extension().unwrap());

pub fn join(&self, path: impl AsRef<Utf8Path>) -> Utf8PathBuf

Creates an owned [Utf8PathBuf] with path adjoined to self.

See [Utf8PathBuf::push] for more details on what it means to adjoin a path.

§Examples
use camino::{Utf8Path, Utf8PathBuf};

assert_eq!(Utf8Path::new("/etc").join("passwd"), Utf8PathBuf::from("/etc/passwd"));

pub fn join_os(&self, path: impl AsRef<Path>) -> PathBuf

Creates an owned PathBuf with path adjoined to self.

See PathBuf::push for more details on what it means to adjoin a path.

§Examples
use camino::Utf8Path;
use std::path::PathBuf;

assert_eq!(Utf8Path::new("/etc").join_os("passwd"), PathBuf::from("/etc/passwd"));

pub fn with_file_name(&self, file_name: impl AsRef<str>) -> Utf8PathBuf

Creates an owned [Utf8PathBuf] like self but with the given file name.

See [Utf8PathBuf::set_file_name] for more details.

§Examples
use camino::{Utf8Path, Utf8PathBuf};

let path = Utf8Path::new("/tmp/foo.txt");
assert_eq!(path.with_file_name("bar.txt"), Utf8PathBuf::from("/tmp/bar.txt"));

let path = Utf8Path::new("/tmp");
assert_eq!(path.with_file_name("var"), Utf8PathBuf::from("/var"));

pub fn with_extension(&self, extension: impl AsRef<str>) -> Utf8PathBuf

Creates an owned [Utf8PathBuf] like self but with the given extension.

See [Utf8PathBuf::set_extension] for more details.

§Examples
use camino::{Utf8Path, Utf8PathBuf};

let path = Utf8Path::new("foo.rs");
assert_eq!(path.with_extension("txt"), Utf8PathBuf::from("foo.txt"));

let path = Utf8Path::new("foo.tar.gz");
assert_eq!(path.with_extension(""), Utf8PathBuf::from("foo.tar"));
assert_eq!(path.with_extension("xz"), Utf8PathBuf::from("foo.tar.xz"));
assert_eq!(path.with_extension("").with_extension("txt"), Utf8PathBuf::from("foo.txt"));

pub fn components(&self) -> Utf8Components<'_>

Produces an iterator over the [Utf8Component]s of the path.

When parsing the path, there is a small amount of normalization:

  • Repeated separators are ignored, so a/b and a//b both have a and b as components.

  • Occurrences of . are normalized away, except if they are at the beginning of the path. For example, a/./b, a/b/, a/b/. and a/b all have a and b as components, but ./a/b starts with an additional CurDir component.

  • A trailing slash is normalized away, /a/b and /a/b/ are equivalent.

Note that no other normalization takes place; in particular, a/c and a/b/../c are distinct, to account for the possibility that b is a symbolic link (so its parent isn’t a).

§Examples
use camino::{Utf8Component, Utf8Path};

let mut components = Utf8Path::new("/tmp/foo.txt").components();

assert_eq!(components.next(), Some(Utf8Component::RootDir));
assert_eq!(components.next(), Some(Utf8Component::Normal("tmp")));
assert_eq!(components.next(), Some(Utf8Component::Normal("foo.txt")));
assert_eq!(components.next(), None)

pub fn iter(&self) -> Iter<'_>

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

For more information about the particulars of how the path is separated into components, see components.

§Examples
use camino::Utf8Path;

let mut it = Utf8Path::new("/tmp/foo.txt").iter();
assert_eq!(it.next(), Some(std::path::MAIN_SEPARATOR.to_string().as_str()));
assert_eq!(it.next(), Some("tmp"));
assert_eq!(it.next(), Some("foo.txt"));
assert_eq!(it.next(), None)

pub fn metadata(&self) -> Result<Metadata, Error>

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

This function will traverse symbolic links to query information about the destination file.

This is an alias to fs::metadata.

§Examples
use camino::Utf8Path;

let path = Utf8Path::new("/Minas/tirith");
let metadata = path.metadata().expect("metadata call failed");
println!("{:?}", metadata.file_type());

Queries the metadata about a file without following symlinks.

This is an alias to fs::symlink_metadata.

§Examples
use camino::Utf8Path;

let path = Utf8Path::new("/Minas/tirith");
let metadata = path.symlink_metadata().expect("symlink_metadata call failed");
println!("{:?}", metadata.file_type());

pub fn canonicalize(&self) -> Result<PathBuf, Error>

Returns the canonical, absolute form of the path with all intermediate components normalized and symbolic links resolved.

This returns a PathBuf because even if a symlink is valid Unicode, its target may not be. For a version that returns a [Utf8PathBuf], see canonicalize_utf8.

This is an alias to fs::canonicalize.

§Examples
use camino::Utf8Path;
use std::path::PathBuf;

let path = Utf8Path::new("/foo/test/../test/bar.rs");
assert_eq!(path.canonicalize().unwrap(), PathBuf::from("/foo/test/bar.rs"));

pub fn canonicalize_utf8(&self) -> Result<Utf8PathBuf, Error>

Returns the canonical, absolute form of the path with all intermediate components normalized and symbolic links resolved.

This method attempts to convert the resulting PathBuf into a [Utf8PathBuf]. For a version that does not attempt to do this conversion, see canonicalize.

§Errors

The I/O operation may return an error: see the fs::canonicalize documentation for more.

If the resulting path is not UTF-8, an io::Error is returned with the ErrorKind set to InvalidData and the payload set to a [FromPathBufError].

§Examples
use camino::{Utf8Path, Utf8PathBuf};

let path = Utf8Path::new("/foo/test/../test/bar.rs");
assert_eq!(path.canonicalize_utf8().unwrap(), Utf8PathBuf::from("/foo/test/bar.rs"));

Reads a symbolic link, returning the file that the link points to.

This returns a PathBuf because even if a symlink is valid Unicode, its target may not be. For a version that returns a [Utf8PathBuf], see read_link_utf8.

This is an alias to fs::read_link.

§Examples
use camino::Utf8Path;

let path = Utf8Path::new("/laputa/sky_castle.rs");
let path_link = path.read_link().expect("read_link call failed");

Reads a symbolic link, returning the file that the link points to.

This method attempts to convert the resulting PathBuf into a [Utf8PathBuf]. For a version that does not attempt to do this conversion, see read_link.

§Errors

The I/O operation may return an error: see the fs::read_link documentation for more.

If the resulting path is not UTF-8, an io::Error is returned with the ErrorKind set to InvalidData and the payload set to a [FromPathBufError].

§Examples
use camino::Utf8Path;

let path = Utf8Path::new("/laputa/sky_castle.rs");
let path_link = path.read_link_utf8().expect("read_link call failed");

pub fn read_dir(&self) -> Result<ReadDir, Error>

Returns an iterator over the entries within a directory.

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

This is an alias to fs::read_dir.

§Examples
use camino::Utf8Path;

let path = Utf8Path::new("/laputa");
for entry in path.read_dir().expect("read_dir call failed") {
    if let Ok(entry) = entry {
        println!("{:?}", entry.path());
    }
}

pub fn read_dir_utf8(&self) -> Result<ReadDirUtf8, Error>

Returns an iterator over the entries within a directory.

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

§Errors

The I/O operation may return an error: see the fs::read_dir documentation for more.

If a directory entry is not UTF-8, an io::Error is returned with the ErrorKind set to InvalidData and the payload set to a [FromPathBufError].

§Examples
use camino::Utf8Path;

let path = Utf8Path::new("/laputa");
for entry in path.read_dir_utf8().expect("read_dir call failed") {
    if let Ok(entry) = entry {
        println!("{}", entry.path());
    }
}

pub fn exists(&self) -> bool

Returns true if the path points at an existing entity.

Warning: this method may be error-prone, consider using try_exists() instead! It also has a risk of introducing time-of-check to time-of-use (TOCTOU) bugs.

This function will traverse symbolic links to query information about the destination file. In case of broken symbolic links this will return false.

If you cannot access the directory containing the file, e.g., because of a permission error, this will return false.

§Examples
use camino::Utf8Path;
assert!(!Utf8Path::new("does_not_exist.txt").exists());
§See Also

This is a convenience function that coerces errors to false. If you want to check errors, call fs::metadata.

pub fn try_exists(&self) -> Result<bool, Error>

Returns Ok(true) if the path points at an existing entity.

This function will traverse symbolic links to query information about the destination file. In case of broken symbolic links this will return Ok(false).

As opposed to the exists() method, this one doesn’t silently ignore errors unrelated to the path not existing. (E.g. it will return Err(_) in case of permission denied on some of the parent directories.)

Note that while this avoids some pitfalls of the exists() method, it still can not prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios where those bugs are not an issue.

§Examples
use camino::Utf8Path;
assert!(!Utf8Path::new("does_not_exist.txt").try_exists().expect("Can't check existence of file does_not_exist.txt"));
assert!(Utf8Path::new("/root/secret_file.txt").try_exists().is_err());

pub fn is_file(&self) -> bool

Returns true if the path exists on disk and is pointing at a regular file.

This function will traverse symbolic links to query information about the destination file. In case of broken symbolic links this will return false.

If you cannot access the directory containing the file, e.g., because of a permission error, this will return false.

§Examples
use camino::Utf8Path;
assert_eq!(Utf8Path::new("./is_a_directory/").is_file(), false);
assert_eq!(Utf8Path::new("a_file.txt").is_file(), true);
§See Also

This is a convenience function that coerces errors to false. If you want to check errors, call fs::metadata and handle its Result. Then call fs::Metadata::is_file if it was Ok.

When the goal is simply to read from (or write to) the source, the most reliable way to test the source can be read (or written to) is to open it. Only using is_file can break workflows like diff <( prog_a ) on a Unix-like system for example. See fs::File::open or fs::OpenOptions::open for more information.

pub fn is_dir(&self) -> bool

Returns true if the path exists on disk and is pointing at a directory.

This function will traverse symbolic links to query information about the destination file. In case of broken symbolic links this will return false.

If you cannot access the directory containing the file, e.g., because of a permission error, this will return false.

§Examples
use camino::Utf8Path;
assert_eq!(Utf8Path::new("./is_a_directory/").is_dir(), true);
assert_eq!(Utf8Path::new("a_file.txt").is_dir(), false);
§See Also

This is a convenience function that coerces errors to false. If you want to check errors, call fs::metadata and handle its Result. Then call fs::Metadata::is_dir if it was Ok.

Returns true if the path exists on disk and is pointing at a symbolic link.

This function will not traverse symbolic links. In case of a broken symbolic link this will also return true.

If you cannot access the directory containing the file, e.g., because of a permission error, this will return false.

§Examples
use camino::Utf8Path;
use std::os::unix::fs::symlink;

let link_path = Utf8Path::new("link");
symlink("/origin_does_not_exist/", link_path).unwrap();
assert_eq!(link_path.is_symlink(), true);
assert_eq!(link_path.exists(), false);
§See Also

This is a convenience function that coerces errors to false. If you want to check errors, call [Utf8Path::symlink_metadata] and handle its Result. Then call fs::Metadata::is_symlink if it was Ok.

Trait Implementations§

Source§

impl AsRef<Path> for ChildPath

Source§

fn as_ref(&self) -> &Path

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<Utf8Path> for ChildPath

Source§

fn as_ref(&self) -> &Utf8Path

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for ChildPath

Source§

fn clone(&self) -> ChildPath

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ChildPath

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deref for ChildPath

Source§

type Target = Utf8Path

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Utf8Path

Dereferences the value.
Source§

impl FileTouch for ChildPath

Source§

fn touch(&self) -> Result<(), FixtureError>

Create an empty file at ChildPath. Read more
Source§

impl FileWriteBin for ChildPath

Source§

fn write_binary(&self, data: &[u8]) -> Result<(), FixtureError>

Write a binary file at ChildPath. Read more
Source§

impl FileWriteFile for ChildPath

Source§

fn write_file(&self, data: &Utf8Path) -> Result<(), FixtureError>

Write (copy) a file to ChildPath. Read more
Source§

impl FileWriteStr for ChildPath

Source§

fn write_str(&self, data: &str) -> Result<(), FixtureError>

Write a text file at ChildPath or NamedUtf8TempFile. Read more
Source§

impl Hash for ChildPath

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for ChildPath

Source§

fn cmp(&self, other: &ChildPath) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq<&Path> for ChildPath

Source§

fn eq(&self, other: &&Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<&Utf8Path> for ChildPath

Source§

fn eq(&self, other: &&Utf8Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<ChildPath> for &Path

Source§

fn eq(&self, other: &ChildPath) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<ChildPath> for &Utf8Path

Source§

fn eq(&self, other: &ChildPath) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<ChildPath> for Cow<'_, Path>

Source§

fn eq(&self, other: &ChildPath) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<ChildPath> for Cow<'_, Utf8Path>

Source§

fn eq(&self, other: &ChildPath) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<ChildPath> for Path

Source§

fn eq(&self, other: &ChildPath) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<ChildPath> for PathBuf

Source§

fn eq(&self, other: &ChildPath) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<ChildPath> for Utf8Path

Source§

fn eq(&self, other: &ChildPath) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<ChildPath> for Utf8PathBuf

Source§

fn eq(&self, other: &ChildPath) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Cow<'_, Path>> for ChildPath

Source§

fn eq(&self, other: &Cow<'_, Path>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Cow<'_, Utf8Path>> for ChildPath

Source§

fn eq(&self, other: &Cow<'_, Utf8Path>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Path> for ChildPath

Source§

fn eq(&self, other: &Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<PathBuf> for ChildPath

Source§

fn eq(&self, other: &PathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Utf8Path> for ChildPath

Source§

fn eq(&self, other: &Utf8Path) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Utf8PathBuf> for ChildPath

Source§

fn eq(&self, other: &Utf8PathBuf) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for ChildPath

Source§

fn eq(&self, other: &ChildPath) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for ChildPath

Source§

fn partial_cmp(&self, other: &ChildPath) -> Option<Ordering>

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

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PathAssert for ChildPath

Available on crate feature assert only.
Source§

fn assert<I, P>(&self, pred: I) -> &Self
where I: IntoUtf8PathPredicate<P>, P: Predicate<Utf8Path>,

Assert the state of files within a Utf8TempDir. Read more
Source§

impl PathChild for ChildPath

Source§

fn child<P: AsRef<Utf8Path>>(&self, path: P) -> ChildPath

Access a path within the temporary directory. Read more
Source§

impl PathCopy for ChildPath

Source§

fn copy_from<P: AsRef<Utf8Path>, S: AsRef<str>>( &self, source: P, patterns: &[S], ) -> Result<(), FixtureError>

Copy files and directories into the current path from the source according to the glob patterns. Read more
Source§

impl PathCreateDir for ChildPath

Source§

fn create_dir_all(&self) -> Result<(), FixtureError>

Create an empty directory at ChildPath. Read more
Source§

impl SymlinkToDir for ChildPath

Create a symlink to the provided target directory. Read more
Source§

impl SymlinkToFile for ChildPath

Create a symlink to the provided target file. Read more
Source§

impl Eq for ChildPath

Source§

impl StructuralPartialEq for ChildPath

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Sequence for T
where T: Eq + Hash,