camino

Struct Utf8PathBuf

Source
pub struct Utf8PathBuf(/* private fields */);
Expand description

An owned, mutable UTF-8 path (akin to String).

This type provides methods like push and set_extension that mutate the path in place. It also implements Deref to Utf8Path, meaning that all methods on Utf8Path slices are available on Utf8PathBuf values as well.

§Examples

You can use push to build up a Utf8PathBuf from components:

use camino::Utf8PathBuf;

let mut path = Utf8PathBuf::new();

path.push(r"C:\");
path.push("windows");
path.push("system32");

path.set_extension("dll");

However, push is best used for dynamic situations. This is a better way to do this when you know all of the components ahead of time:

use camino::Utf8PathBuf;

let path: Utf8PathBuf = [r"C:\", "windows", "system32.dll"].iter().collect();

We can still do better than this! Since these are all strings, we can use From::from:

use camino::Utf8PathBuf;

let path = Utf8PathBuf::from(r"C:\windows\system32.dll");

Which method works best depends on what kind of situation you’re in.

Implementations§

Source§

impl Utf8PathBuf

Source

pub fn new() -> Utf8PathBuf

Allocates an empty Utf8PathBuf.

§Examples
use camino::Utf8PathBuf;

let path = Utf8PathBuf::new();
Source

pub fn from_path_buf(path: PathBuf) -> Result<Utf8PathBuf, PathBuf>

Creates a new Utf8PathBuf from a PathBuf containing valid UTF-8 characters.

Errors with the original PathBuf if it is not valid UTF-8.

For a version that returns a type that implements std::error::Error, use the TryFrom<PathBuf> impl.

§Examples
use camino::Utf8PathBuf;
use std::ffi::OsStr;
use std::os::unix::ffi::OsStrExt;
use std::path::PathBuf;

let unicode_path = PathBuf::from("/valid/unicode");
Utf8PathBuf::from_path_buf(unicode_path).expect("valid Unicode path succeeded");

// Paths on Unix can be non-UTF-8.
let non_unicode_str = OsStr::from_bytes(b"\xFF\xFF\xFF");
let non_unicode_path = PathBuf::from(non_unicode_str);
Utf8PathBuf::from_path_buf(non_unicode_path).expect_err("non-Unicode path failed");
Source

pub fn into_std_path_buf(self) -> PathBuf

Converts a Utf8PathBuf to a PathBuf.

This is equivalent to the From<Utf8PathBuf> for PathBuf impl, but may aid in type inference.

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

let utf8_path_buf = Utf8PathBuf::from("foo.txt");
let std_path_buf = utf8_path_buf.into_std_path_buf();
assert_eq!(std_path_buf.to_str(), Some("foo.txt"));

// Convert back to a Utf8PathBuf.
let new_utf8_path_buf = Utf8PathBuf::from_path_buf(std_path_buf).unwrap();
assert_eq!(new_utf8_path_buf, "foo.txt");
Source

pub fn with_capacity(capacity: usize) -> Utf8PathBuf

Creates a new Utf8PathBuf with a given capacity used to create the internal PathBuf. See with_capacity defined on PathBuf.

Requires Rust 1.44 or newer.

§Examples
use camino::Utf8PathBuf;

let mut path = Utf8PathBuf::with_capacity(10);
let capacity = path.capacity();

// This push is done without reallocating
path.push(r"C:\");

assert_eq!(capacity, path.capacity());
Source

pub fn as_path(&self) -> &Utf8Path

Coerces to a Utf8Path slice.

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

let p = Utf8PathBuf::from("/test");
assert_eq!(Utf8Path::new("/test"), p.as_path());
Source

pub fn push(&mut self, path: impl AsRef<Utf8Path>)

Extends self with path.

If path is absolute, it replaces the current path.

On Windows:

  • if path has a root but no prefix (e.g., \windows), it replaces everything except for the prefix (if any) of self.
  • if path has a prefix but no root, it replaces self.
§Examples

Pushing a relative path extends the existing path:

use camino::Utf8PathBuf;

let mut path = Utf8PathBuf::from("/tmp");
path.push("file.bk");
assert_eq!(path, Utf8PathBuf::from("/tmp/file.bk"));

Pushing an absolute path replaces the existing path:

use camino::Utf8PathBuf;

let mut path = Utf8PathBuf::from("/tmp");
path.push("/etc");
assert_eq!(path, Utf8PathBuf::from("/etc"));
Source

pub fn pop(&mut self) -> bool

Truncates self to self.parent.

Returns false and does nothing if self.parent is None. Otherwise, returns true.

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

let mut p = Utf8PathBuf::from("/spirited/away.rs");

p.pop();
assert_eq!(Utf8Path::new("/spirited"), p);
p.pop();
assert_eq!(Utf8Path::new("/"), p);
Source

pub fn set_file_name(&mut self, file_name: impl AsRef<str>)

Updates self.file_name to file_name.

If self.file_name was None, this is equivalent to pushing file_name.

Otherwise it is equivalent to calling pop and then pushing file_name. The new path will be a sibling of the original path. (That is, it will have the same parent.)

§Examples
use camino::Utf8PathBuf;

let mut buf = Utf8PathBuf::from("/");
assert_eq!(buf.file_name(), None);
buf.set_file_name("bar");
assert_eq!(buf, Utf8PathBuf::from("/bar"));
assert!(buf.file_name().is_some());
buf.set_file_name("baz.txt");
assert_eq!(buf, Utf8PathBuf::from("/baz.txt"));
Source

pub fn set_extension(&mut self, extension: impl AsRef<str>) -> bool

Updates self.extension to extension.

Returns false and does nothing if self.file_name is None, returns true and updates the extension otherwise.

If self.extension is None, the extension is added; otherwise it is replaced.

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

let mut p = Utf8PathBuf::from("/feel/the");

p.set_extension("force");
assert_eq!(Utf8Path::new("/feel/the.force"), p.as_path());

p.set_extension("dark_side");
assert_eq!(Utf8Path::new("/feel/the.dark_side"), p.as_path());
Source

pub fn into_string(self) -> String

Consumes the Utf8PathBuf, yielding its internal String storage.

§Examples
use camino::Utf8PathBuf;

let p = Utf8PathBuf::from("/the/head");
let s = p.into_string();
assert_eq!(s, "/the/head");
Source

pub fn into_os_string(self) -> OsString

Consumes the Utf8PathBuf, yielding its internal OsString storage.

§Examples
use camino::Utf8PathBuf;
use std::ffi::OsStr;

let p = Utf8PathBuf::from("/the/head");
let s = p.into_os_string();
assert_eq!(s, OsStr::new("/the/head"));
Source

pub fn into_boxed_path(self) -> Box<Utf8Path>

Converts this Utf8PathBuf into a boxed Utf8Path.

Source

pub fn capacity(&self) -> usize

Invokes capacity on the underlying instance of PathBuf.

Requires Rust 1.44 or newer.

Source

pub fn clear(&mut self)

Invokes clear on the underlying instance of PathBuf.

Requires Rust 1.44 or newer.

Source

pub fn reserve(&mut self, additional: usize)

Invokes reserve on the underlying instance of PathBuf.

Requires Rust 1.44 or newer.

Source

pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>

Invokes try_reserve on the underlying instance of PathBuf.

Requires Rust 1.63 or newer.

Source

pub fn reserve_exact(&mut self, additional: usize)

Invokes reserve_exact on the underlying instance of PathBuf.

Requires Rust 1.44 or newer.

Source

pub fn try_reserve_exact( &mut self, additional: usize, ) -> Result<(), TryReserveError>

Invokes try_reserve_exact on the underlying instance of PathBuf.

Requires Rust 1.63 or newer.

Source

pub fn shrink_to_fit(&mut self)

Invokes shrink_to_fit on the underlying instance of PathBuf.

Requires Rust 1.44 or newer.

Source

pub fn shrink_to(&mut self, min_capacity: usize)

Invokes shrink_to on the underlying instance of PathBuf.

Requires Rust 1.56 or newer.

Methods from Deref<Target = Utf8Path>§

Source

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");
Source

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");
Source

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"));
Source

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"));
Source

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());
Source

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());
Source

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());
Source

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);
Source

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);
Source

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());
Source

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")));
Source

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"));
Source

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
Source

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());
Source

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());
Source

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"));
Source

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"));
Source

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"));
Source

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"));
Source

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

Produces an iterator over the Utf8Components 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)
Source

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)
Source

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

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());
Source

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

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"));
Source

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

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");
Source

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

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());
    }
}
Source

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

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());
    }
}
Source

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.

Source

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

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());
Source

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.

Source

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 Arbitrary for Utf8PathBuf

The [Arbitrary] impl for Utf8PathBuf returns a path with between 0 and 8 components, joined by the MAIN_SEPARATOR for the platform. (Each component is randomly generated, and may itself contain one or more separators.)

On Unix, this generates an absolute path half of the time and a relative path the other half.

On Windows, this implementation doesn’t currently generate Utf8PrefixComponent instances, though in the future it might.

Source§

type Parameters = <String as Arbitrary>::Parameters

The type of parameters that arbitrary_with accepts for configuration of the generated Strategy. Parameters must implement Default.
Source§

type Strategy = BoxedStrategy<Utf8PathBuf>

The type of Strategy used to generate values of type Self.
Source§

fn arbitrary_with(args: Self::Parameters) -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). The strategy is passed the arguments given in args. Read more
§

fn arbitrary() -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). Read more
Source§

impl AsRef<OsStr> for Utf8PathBuf

Source§

fn as_ref(&self) -> &OsStr

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

impl AsRef<Path> for Utf8PathBuf

Source§

fn as_ref(&self) -> &Path

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

impl AsRef<Utf8Path> for Utf8PathBuf

Source§

fn as_ref(&self) -> &Utf8Path

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

impl AsRef<str> for Utf8PathBuf

Source§

fn as_ref(&self) -> &str

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

impl Borrow<Utf8Path> for Utf8PathBuf

Source§

fn borrow(&self) -> &Utf8Path

Immutably borrows from an owned value. Read more
Source§

impl Clone for Utf8PathBuf

Source§

fn clone(&self) -> Utf8PathBuf

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 Utf8PathBuf

Source§

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

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

impl Default for Utf8PathBuf

Source§

fn default() -> Utf8PathBuf

Returns the “default value” for a type. Read more
Source§

impl Deref for Utf8PathBuf

Source§

type Target = Utf8Path

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Utf8Path

Dereferences the value.
Source§

impl<'de> Deserialize<'de> for Utf8PathBuf

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Utf8PathBuf

Source§

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

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

impl<P: AsRef<Utf8Path>> Extend<P> for Utf8PathBuf

Source§

fn extend<I: IntoIterator<Item = P>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T: ?Sized + AsRef<str>> From<&T> for Utf8PathBuf

Source§

fn from(s: &T) -> Utf8PathBuf

Converts to this type from the input type.
Source§

impl From<Box<Utf8Path>> for Utf8PathBuf

Source§

fn from(path: Box<Utf8Path>) -> Utf8PathBuf

Converts to this type from the input type.
Source§

impl<'a> From<Cow<'a, Utf8Path>> for Utf8PathBuf

Source§

fn from(path: Cow<'a, Utf8Path>) -> Utf8PathBuf

Converts to this type from the input type.
Source§

impl From<String> for Utf8PathBuf

Source§

fn from(string: String) -> Utf8PathBuf

Converts to this type from the input type.
Source§

impl From<Utf8PathBuf> for Arc<Path>

Source§

fn from(path: Utf8PathBuf) -> Arc<Path>

Converts to this type from the input type.
Source§

impl From<Utf8PathBuf> for Arc<Utf8Path>

Source§

fn from(path: Utf8PathBuf) -> Arc<Utf8Path>

Converts to this type from the input type.
Source§

impl From<Utf8PathBuf> for Box<Path>

Source§

fn from(path: Utf8PathBuf) -> Box<Path>

Converts to this type from the input type.
Source§

impl From<Utf8PathBuf> for Box<Utf8Path>

Source§

fn from(path: Utf8PathBuf) -> Box<Utf8Path>

Converts to this type from the input type.
Source§

impl<'a> From<Utf8PathBuf> for Cow<'a, Path>

Source§

fn from(path: Utf8PathBuf) -> Cow<'a, Path>

Converts to this type from the input type.
Source§

impl<'a> From<Utf8PathBuf> for Cow<'a, Utf8Path>

Source§

fn from(path: Utf8PathBuf) -> Cow<'a, Utf8Path>

Converts to this type from the input type.
Source§

impl From<Utf8PathBuf> for OsString

Source§

fn from(path: Utf8PathBuf) -> OsString

Converts to this type from the input type.
Source§

impl From<Utf8PathBuf> for PathBuf

Source§

fn from(path: Utf8PathBuf) -> PathBuf

Converts to this type from the input type.
Source§

impl From<Utf8PathBuf> for Rc<Path>

Source§

fn from(path: Utf8PathBuf) -> Rc<Path>

Converts to this type from the input type.
Source§

impl From<Utf8PathBuf> for Rc<Utf8Path>

Source§

fn from(path: Utf8PathBuf) -> Rc<Utf8Path>

Converts to this type from the input type.
Source§

impl From<Utf8PathBuf> for String

Source§

fn from(path: Utf8PathBuf) -> String

Converts to this type from the input type.
Source§

impl<P: AsRef<Utf8Path>> FromIterator<P> for Utf8PathBuf

Source§

fn from_iter<I: IntoIterator<Item = P>>(iter: I) -> Utf8PathBuf

Creates a value from an iterator. Read more
Source§

impl FromStr for Utf8PathBuf

Source§

type Err = Infallible

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for Utf8PathBuf

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<'a> IntoIterator for &'a Utf8PathBuf

Source§

type Item = &'a str

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Iter<'a>

Creates an iterator from a value. Read more
Source§

impl Ord for Utf8PathBuf

Source§

fn cmp(&self, other: &Utf8PathBuf) -> 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<'a, 'b> PartialEq<&'a OsStr> for Utf8PathBuf

Source§

fn eq(&self, other: &&'a OsStr) -> 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<'a, 'b> PartialEq<&'a Path> for Utf8PathBuf

Source§

fn eq(&self, other: &&'a 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<'a, 'b> PartialEq<&'a Utf8Path> for Utf8PathBuf

Source§

fn eq(&self, other: &&'a 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<'a, 'b> PartialEq<&'a str> for Utf8PathBuf

Source§

fn eq(&self, other: &&'a str) -> 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<'a, 'b> PartialEq<Cow<'a, OsStr>> for Utf8PathBuf

Source§

fn eq(&self, other: &Cow<'a, OsStr>) -> 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<'a, 'b> PartialEq<Cow<'a, Path>> for Utf8PathBuf

Source§

fn eq(&self, other: &Cow<'a, 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<'a, 'b> PartialEq<Cow<'a, Utf8Path>> for Utf8PathBuf

Source§

fn eq(&self, other: &Cow<'a, 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<'a, 'b> PartialEq<Cow<'a, str>> for Utf8PathBuf

Source§

fn eq(&self, other: &Cow<'a, str>) -> 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<'a, 'b> PartialEq<OsStr> for Utf8PathBuf

Source§

fn eq(&self, other: &OsStr) -> 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<'a, 'b> PartialEq<OsString> for Utf8PathBuf

Source§

fn eq(&self, other: &OsString) -> 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<'a, 'b> PartialEq<Path> for Utf8PathBuf

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<'a, 'b> PartialEq<PathBuf> for Utf8PathBuf

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<'a, 'b> PartialEq<String> for Utf8PathBuf

Source§

fn eq(&self, other: &String) -> 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<'a, 'b> PartialEq<Utf8Path> for Utf8PathBuf

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<'a, 'b> PartialEq<Utf8PathBuf> for &'a OsStr

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<'a, 'b> PartialEq<Utf8PathBuf> for &'a Path

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<'a, 'b> PartialEq<Utf8PathBuf> for &'a Utf8Path

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<'a, 'b> PartialEq<Utf8PathBuf> for &'a str

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<'a, 'b> PartialEq<Utf8PathBuf> for Cow<'a, OsStr>

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<'a, 'b> PartialEq<Utf8PathBuf> for Cow<'a, Path>

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<'a, 'b> PartialEq<Utf8PathBuf> for Cow<'a, Utf8Path>

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<'a, 'b> PartialEq<Utf8PathBuf> for Cow<'a, str>

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<'a, 'b> PartialEq<Utf8PathBuf> for OsStr

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<'a, 'b> PartialEq<Utf8PathBuf> for OsString

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<'a, 'b> PartialEq<Utf8PathBuf> for Path

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<'a, 'b> PartialEq<Utf8PathBuf> for PathBuf

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<'a, 'b> PartialEq<Utf8PathBuf> for String

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<'a, 'b> PartialEq<Utf8PathBuf> for Utf8Path

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<'a, 'b> PartialEq<Utf8PathBuf> for str

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<'a, 'b> PartialEq<str> for Utf8PathBuf

Source§

fn eq(&self, other: &str) -> 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 Utf8PathBuf

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<'a, 'b> PartialOrd<&'a OsStr> for Utf8PathBuf

Source§

fn partial_cmp(&self, other: &&'a OsStr) -> 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<'a, 'b> PartialOrd<&'a Path> for Utf8PathBuf

Source§

fn partial_cmp(&self, other: &&'a Path) -> 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<'a, 'b> PartialOrd<&'a Utf8Path> for Utf8PathBuf

Source§

fn partial_cmp(&self, other: &&'a Utf8Path) -> 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<'a, 'b> PartialOrd<&'a str> for Utf8PathBuf

Source§

fn partial_cmp(&self, other: &&'a str) -> 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<'a, 'b> PartialOrd<Cow<'a, OsStr>> for Utf8PathBuf

Source§

fn partial_cmp(&self, other: &Cow<'a, OsStr>) -> 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<'a, 'b> PartialOrd<Cow<'a, Path>> for Utf8PathBuf

Source§

fn partial_cmp(&self, other: &Cow<'a, Path>) -> 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<'a, 'b> PartialOrd<Cow<'a, Utf8Path>> for Utf8PathBuf

Source§

fn partial_cmp(&self, other: &Cow<'a, Utf8Path>) -> 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<'a, 'b> PartialOrd<Cow<'a, str>> for Utf8PathBuf

Source§

fn partial_cmp(&self, other: &Cow<'a, str>) -> 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<'a, 'b> PartialOrd<OsStr> for Utf8PathBuf

Source§

fn partial_cmp(&self, other: &OsStr) -> 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<'a, 'b> PartialOrd<OsString> for Utf8PathBuf

Source§

fn partial_cmp(&self, other: &OsString) -> 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<'a, 'b> PartialOrd<Path> for Utf8PathBuf

Source§

fn partial_cmp(&self, other: &Path) -> 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<'a, 'b> PartialOrd<PathBuf> for Utf8PathBuf

Source§

fn partial_cmp(&self, other: &PathBuf) -> 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<'a, 'b> PartialOrd<String> for Utf8PathBuf

Source§

fn partial_cmp(&self, other: &String) -> 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<'a, 'b> PartialOrd<Utf8Path> for Utf8PathBuf

Source§

fn partial_cmp(&self, other: &Utf8Path) -> 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<'a, 'b> PartialOrd<Utf8PathBuf> for &'a OsStr

Source§

fn partial_cmp(&self, other: &Utf8PathBuf) -> 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<'a, 'b> PartialOrd<Utf8PathBuf> for &'a Path

Source§

fn partial_cmp(&self, other: &Utf8PathBuf) -> 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<'a, 'b> PartialOrd<Utf8PathBuf> for &'a Utf8Path

Source§

fn partial_cmp(&self, other: &Utf8PathBuf) -> 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<'a, 'b> PartialOrd<Utf8PathBuf> for &'a str

Source§

fn partial_cmp(&self, other: &Utf8PathBuf) -> 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<'a, 'b> PartialOrd<Utf8PathBuf> for Cow<'a, OsStr>

Source§

fn partial_cmp(&self, other: &Utf8PathBuf) -> 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<'a, 'b> PartialOrd<Utf8PathBuf> for Cow<'a, Path>

Source§

fn partial_cmp(&self, other: &Utf8PathBuf) -> 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<'a, 'b> PartialOrd<Utf8PathBuf> for Cow<'a, Utf8Path>

Source§

fn partial_cmp(&self, other: &Utf8PathBuf) -> 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<'a, 'b> PartialOrd<Utf8PathBuf> for Cow<'a, str>

Source§

fn partial_cmp(&self, other: &Utf8PathBuf) -> 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<'a, 'b> PartialOrd<Utf8PathBuf> for OsStr

Source§

fn partial_cmp(&self, other: &Utf8PathBuf) -> 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<'a, 'b> PartialOrd<Utf8PathBuf> for OsString

Source§

fn partial_cmp(&self, other: &Utf8PathBuf) -> 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<'a, 'b> PartialOrd<Utf8PathBuf> for Path

Source§

fn partial_cmp(&self, other: &Utf8PathBuf) -> 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<'a, 'b> PartialOrd<Utf8PathBuf> for PathBuf

Source§

fn partial_cmp(&self, other: &Utf8PathBuf) -> 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<'a, 'b> PartialOrd<Utf8PathBuf> for String

Source§

fn partial_cmp(&self, other: &Utf8PathBuf) -> 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<'a, 'b> PartialOrd<Utf8PathBuf> for Utf8Path

Source§

fn partial_cmp(&self, other: &Utf8PathBuf) -> 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<'a, 'b> PartialOrd<Utf8PathBuf> for str

Source§

fn partial_cmp(&self, other: &Utf8PathBuf) -> 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<'a, 'b> PartialOrd<str> for Utf8PathBuf

Source§

fn partial_cmp(&self, other: &str) -> 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 PartialOrd for Utf8PathBuf

Source§

fn partial_cmp(&self, other: &Utf8PathBuf) -> 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 Serialize for Utf8PathBuf

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<PathBuf> for Utf8PathBuf

Source§

type Error = FromPathBufError

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

fn try_from(path: PathBuf) -> Result<Utf8PathBuf, Self::Error>

Performs the conversion.
Source§

impl Eq for Utf8PathBuf

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 T)

🔬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.

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> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. 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<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,