Struct std::path::PathBuf1.0.0[−][src]

pub struct PathBuf { /* fields omitted */ }
Expand description

拥有的可变路径 (类似于 String)。

这种类型提供了 push 和 set_extension 之类的方法,这些方法会改变路径。 它还实现了 Deref 到 Path,这意味着 Path 切片上的所有方法也可以在 PathBuf 值上使用。

有关整体方法的更多详细信息,请参见 module documentation。

Examples

您可以使用 push 从组件构建 PathBuf:

use std::path::PathBuf;

let mut path = PathBuf::new();

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

path.set_extension("dll");
Run

但是,push 最适合用于动态情况。 当您提前了解所有组件时,这是一种更好的方法:

use std::path::PathBuf;

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

我们仍然可以做得更好! 由于这些都是字符串,因此我们可以使用 From::from:

use std::path::PathBuf;

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

哪种方法最有效取决于您所处的情况。

Implementations

分配一个空的 PathBuf。

Examples

use std::path::PathBuf;

let path = PathBuf::new();
Run

创建具有给定容量的新 PathBuf,用于创建内部 OsString。 请参见在 OsString 上定义的 with_capacity。

Examples

use std::path::PathBuf;

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

// 无需重新分配即可完成此推送
path.push(r"C:\");

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

强制转换为 Path 切片。

Examples

use std::path::{Path, PathBuf};

let p = PathBuf::from("/test");
assert_eq!(Path::new("/test"), p.as_path());
Run

用 path 扩展 self。

如果 path 是绝对路径,它将替换当前路径。

在 Windows 上:

  • 如果 path 具有根但没有前缀 (例如 \windows),它将替换 self 的前缀 (如果有) 之外的所有内容。

  • 如果 path 有前缀但没有根,它将替换 self。

Examples

推动相对路径可扩展现有路径:

use std::path::PathBuf;

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

推送绝对路径将替换现有路径:

use std::path::PathBuf;

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

将 self 截断为 self.parent。

返回 false,如果 self.parent 为 None,则不执行任何操作。 否则,返回 true。

Examples

use std::path::{Path, PathBuf};

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

p.pop();
assert_eq!(Path::new("/spirited"), p);
p.pop();
assert_eq!(Path::new("/"), p);
Run

将 self.file_name 更新为 file_name。

如果 self.file_name 是 None,则等效于按下 file_name。

否则,这等效于调用 pop,然后按 file_name。 新路径将是原始路径的同级。 (也就是说,它将具有相同的父对象。)

Examples

use std::path::PathBuf;

let mut buf = PathBuf::from("/");
assert!(buf.file_name() == None);
buf.set_file_name("bar");
assert!(buf == PathBuf::from("/bar"));
assert!(buf.file_name().is_some());
buf.set_file_name("baz.txt");
assert!(buf == PathBuf::from("/baz.txt"));
Run

将 self.extension 更新为 extension。

返回 false,如果 self.file_name 为 None,则不执行任何操作,否则返回 true,并更新扩展名。

如果 self.extension 为 None,则添加扩展名; 否则将被替换。

Examples

use std::path::{Path, PathBuf};

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

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

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

消耗 PathBuf,产生其内部 OsString 存储。

Examples

use std::path::PathBuf;

let p = PathBuf::from("/the/head");
let os_str = p.into_os_string();
Run

将此 PathBuf 转换为 boxed Path。

在 OsString 的基础实例上调用 capacity。

在 OsString 的基础实例上调用 clear。

在 OsString 的基础实例上调用 reserve。

在 OsString 的基础实例上调用 reserve_exact。

在 OsString 的基础实例上调用 shrink_to_fit。

🔬 This is a nightly-only experimental API. (shrink_to #56431)

在 OsString 的基础实例上调用 shrink_to。

Methods from Deref<Target = Path>

产生基础的 OsStr 切片。

Examples

use std::path::Path;

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

如果 Path 是有效的 unicode,则产生 &str 切片。

此转换可能需要检查 UTF-8 有效性。 请注意,执行验证是因为非 UTF-8 字符串对于某些 OS 完全有效。

Examples

use std::path::Path;

let path = Path::new("foo.txt");
assert_eq!(path.to_str(), Some("foo.txt"));
Run

将 Path 转换为 Cow<str>。

任何非 Unicode 序列都将替换为 U+FFFD REPLACEMENT CHARACTER。

Examples

使用有效的 Unicode 在 Path 上调用 to_string_lossy:

use std::path::Path;

let path = Path::new("foo.txt");
assert_eq!(path.to_string_lossy(), "foo.txt");
Run

如果 path 包含无效的 unicode,则 to_string_lossy 调用可能已返回 "fo.txt"。

将 Path 转换为拥有的 PathBuf。

Examples

use std::path::Path;

let path_buf = Path::new("foo.txt").to_path_buf();
assert_eq!(path_buf, std::path::PathBuf::from("foo.txt"));
Run

如果 Path 是绝对的,即独立于当前目录,则返回 true。

  • 在 Unix 上,如果路径以根开头,则它是绝对的,因此 is_absolute 和 has_root 是等效的。

  • 在 Windows 上,如果路径具有前缀并以根开头,则它是绝对路径: c:\windows 是绝对路径,而 c:temp 和 \temp 不是。

Examples

use std::path::Path;

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

如果 Path 是相对的,即不是绝对的,则返回 true。

有关更多详细信息,请参见 is_absolute 的文档。

Examples

use std::path::Path;

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

如果 Path 具有根,则返回 true。

  • 在 Unix 上,如果路径以 / 开头,则该路径具有根。

  • 在 Windows 上,如果路径具有根,则它是:

    • 没有前缀,并以分隔符开头,例如, \windows
    • 有一个前缀,后跟一个分隔符,例如 c:\windows,但没有 c:windows
    • 具有任何非磁盘前缀,例如 \\server\share

Examples

use std::path::Path;

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

如果没有 Path,则返回不包含其最终组成部分的 Path。

如果路径以根或前缀结尾,则返回 None。

Examples

use std::path::Path;

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

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

在 Path 及其祖先上生成一个迭代器。

如果 parent 方法使用了 0 次或多次,则迭代器将产生返回的 Path。 这意味着,迭代器将产生 &self,&self.parent().unwrap(),&self.parent().unwrap().parent().unwrap() 等。如果 parent 方法返回 None,则迭代器也将这样做。

迭代器将始终产生至少一个值,即 &self。

Examples

use std::path::Path;

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

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

返回 Path 的最后一个组件 (如果有)。

如果路径是普通文件,则为文件名。 如果是目录路径,则为目录名称。

如果路径以 .. 结尾,则返回 None。

Examples

use std::path::Path;
use std::ffi::OsStr;

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

返回连接到 base 时产生 self 的路径。

Errors

如果 base 不是 self 的前缀 (即 starts_with 返回 false),则返回 Err。

Examples

use std::path::{Path, PathBuf};

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

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

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

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

确定 base 是否为 self 的前缀。

仅考虑整个路径组件匹配。

Examples

use std::path::Path;

let path = Path::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/")); // 额外的斜线是可以的
assert!(path.starts_with("/etc/passwd///")); // multiple extra slashes are okay

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

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

确定 child 是否为 self 的后缀。

仅考虑整个路径组件匹配。

Examples

use std::path::Path;

let path = Path::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")); // 改用 .extension()
Run

提取 self.file_name 的茎 (non-extension) 部分。

词干为:

  • None, 如果没有文件名;
  • 如果没有嵌入式 .,则为整个文件名; 否则为 0。
  • 如果文件名以 . 开头且内部没有其他 .,则为整个文件名;
  • 否则,文件名中最后 . 之前的部分

Examples

use std::path::Path;

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

如果可能,提取 self.file_name 的扩展名。

扩展名是:

  • None, 如果没有文件名;
  • None, 如果没有嵌入式 .;
  • None, 如果文件名以 . 开头,并且里面没有其他 .;
  • 否则,文件名中最后一个 . 之后的部分

Examples

use std::path::Path;

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

创建一个拥有的 PathBuf,并将 path 附加到 self。

有关连接路径的含义的更多详细信息,请参见 PathBuf::push。

Examples

use std::path::{Path, PathBuf};

assert_eq!(Path::new("/etc").join("passwd"), PathBuf::from("/etc/passwd"));
Run

创建一个拥有的 PathBuf,例如 self,但具有给定的文件名。

有关更多详细信息,请参见 PathBuf::set_file_name。

Examples

use std::path::{Path, PathBuf};

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

let path = Path::new("/tmp");
assert_eq!(path.with_file_name("var"), PathBuf::from("/var"));
Run

创建一个拥有的 PathBuf,例如 self,但具有给定的扩展名。

有关更多详细信息,请参见 PathBuf::set_extension。

Examples

use std::path::{Path, PathBuf};

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

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

生成路径的 Component 上的迭代器。

解析路径时,需要进行少量标准化:

  • 重复的分隔符将被忽略,因此 a/b 和 a//b 都具有 a 和 b 作为组件。

  • . 的出现被归一化,除非它们位于路径的开头。 例如,a/./b,a/b/,a/b/. 和 a/b 都具有 a 和 b 作为组件,但是 ./a/b 以附加的 CurDir 组件开头。

  • 尾部的斜杠已标准化,/a/b 和 /a/b/ 是等效的。

请注意,没有其他标准化发生。特别是,a/c 和 a/b/../c 是不同的,以考虑到 b 是符号链接 (因此其父代不是 a) 的可能性。

Examples

use std::path::{Path, Component};
use std::ffi::OsStr;

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

assert_eq!(components.next(), Some(Component::RootDir));
assert_eq!(components.next(), Some(Component::Normal(OsStr::new("tmp"))));
assert_eq!(components.next(), Some(Component::Normal(OsStr::new("foo.txt"))));
assert_eq!(components.next(), None)
Run

在视为 OsStr slice 的路径的组件上生成迭代器。

有关如何将路径分成多个组件的详细信息,请参见 components。

Examples

use std::path::{self, Path};
use std::ffi::OsStr;

let mut it = Path::new("/tmp/foo.txt").iter();
assert_eq!(it.next(), Some(OsStr::new(&path::MAIN_SEPARATOR.to_string())));
assert_eq!(it.next(), Some(OsStr::new("tmp")));
assert_eq!(it.next(), Some(OsStr::new("foo.txt")));
assert_eq!(it.next(), None)
Run

返回实现 Display 的 object,以安全地打印可能包含非 Unicode 数据的路径。

根据平台的不同,这可能会执行有损转换。 如果您想要一个转义路径的实现,请改用 Debug。

Examples

use std::path::Path;

let path = Path::new("/tmp/foo.rs");

println!("{}", path.display());
Run

查询文件系统以获取有关文件,目录等的信息。

该函数将遍历符号链接以查询有关目标文件的信息。

这是 fs::metadata 的别名。

Examples

use std::path::Path;

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

查询有关文件的元数据,而无需遵循符号链接。

这是 fs::symlink_metadata 的别名。

Examples

use std::path::Path;

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

返回路径的规范,绝对形式,所有中间组件均已标准化,符号链接已解析。

这是 fs::canonicalize 的别名。

Examples

use std::path::{Path, PathBuf};

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

读取符号链接,返回链接指向的文件。

这是 fs::read_link 的别名。

Examples

use std::path::Path;

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

返回目录中条目的迭代器。

迭代器将产生 io::Result<fs::DirEntry> 的实例。 最初构造迭代器后,可能会遇到新的错误。

这是 fs::read_dir 的别名。

Examples

use std::path::Path;

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

如果路径指向现有实体,则返回 true。

该函数将遍历符号链接以查询有关目标文件的信息。

如果您无法访问文件的元数据,例如 由于权限错误或损坏的符号链接,这将返回 false。

Examples

use std::path::Path;
assert!(!Path::new("does_not_exist.txt").exists());
Run

也可以看看

这是一个方便的函数,可将错误强制为 false。 如果要检查错误,请调用 fs::metadata。

🔬 This is a nightly-only experimental API. (path_try_exists #83186)

如果路径指向现有实体,则返回 Ok(true)。

该函数将遍历符号链接以查询有关目标文件的信息。 如果符号链接断开,则将返回 Ok(false)。

与 exists() 方法相反,此方法不会默默地忽略与不存在的路径无关的错误。 (E.g. 如果某些父目录的权限被拒绝,它将返回 Err(_)。)

Examples

#![feature(path_try_exists)]

use std::path::Path;
assert!(!Path::new("does_not_exist.txt").try_exists().expect("Can't check existence of file does_not_exist.txt"));
assert!(Path::new("/root/secret_file.txt").try_exists().is_err());
Run

如果路径在磁盘上并且指向常规文件,则返回 true。

该函数将遍历符号链接以查询有关目标文件的信息。

如果您无法访问文件的元数据,例如由于权限错误或损坏的符号链接,这将返回 false。

Examples

use std::path::Path;
assert_eq!(Path::new("./is_a_directory/").is_file(), false);
assert_eq!(Path::new("a_file.txt").is_file(), true);
Run

也可以看看

这是一个方便的函数,可将错误强制为 false。如果要检查错误,请调用 fs::metadata 并处理其 Result。 如果是 Ok,则调用 fs::Metadata::is_file。

当目标只是读取 (或写入) 源时,可以读取 (或写入) 最可靠的测试源方法是打开它。

例如,仅使用 is_file 才能中断类似 Unix 的系统上的工作流,例如 diff <( prog_a )。 有关更多信息,请参见 fs::File::open 或 fs::OpenOptions::open。

如果路径在磁盘上并且指向目录,则返回 true。

该函数将遍历符号链接以查询有关目标文件的信息。

如果您无法访问文件的元数据,例如 由于权限错误或损坏的符号链接,这将返回 false。

Examples

use std::path::Path;
assert_eq!(Path::new("./is_a_directory/").is_dir(), true);
assert_eq!(Path::new("a_file.txt").is_dir(), false);
Run

也可以看看

这是一个方便的函数,可将错误强制为 false。 如果要检查错误,请调用 fs::metadata 并处理其 Result。 如果是 Ok,则调用 fs::Metadata::is_dir。

🔬 This is a nightly-only experimental API. (is_symlink #85748)

如果路径存在于磁盘上并且指向符号链接,则返回 true。

这个函数不会遍历符号链接。 如果符号链接损坏,这也将返回 true。

如果您无法访问包含该文件的目录,例如,由于权限错误,这将返回 false。

Examples

#![feature(is_symlink)]
use std::path::Path;
use std::os::unix::fs::symlink;

let link_path = Path::new("link");
symlink("/origin_does_not_exists/", link_path).unwrap();
assert_eq!(link_path.is_symlink(), true);
assert_eq!(link_path.exists(), false);
Run

Trait Implementations

执行转换。

执行转换。

从拥有的值中一成不变地借用。 Read more

返回值的副本。 Read more

从 source 执行复制分配。 Read more

使用给定的格式化程序格式化该值。 Read more

返回类型的 “default value”。 Read more

解引用后的结果类型。

解引用值。

用迭代器的内容扩展集合。 Read more

🔬 This is a nightly-only experimental API. (extend_one #72631)

用一个元素扩展一个集合。

🔬 This is a nightly-only experimental API. (extend_one #72631)

在集合中为给定数量的附加元素保留容量。 Read more

将借用的 OsStr 转换为 PathBuf。

分配一个 PathBuf 并将数据复制到其中。

创建一个从引用到 PathBuf 的写时克隆指针。

此转换不会克隆或分配。

将 Box<Path> 转换为 PathBuf

此转换不会分配或复制内存。

将写时克隆指针转换为拥有所有权的路径。

从 Cow::Owned 转换不会克隆或分配。

将 OsString 转换为 PathBuf

此转换不会分配或复制内存。

将 PathBuf 转换为 Box<Path>

此转换当前不应该分配内存,但是不能在所有平台上或所有 future 版本中都保证此行为。

将 PathBuf 转换为 OsString

此转换不会分配或复制内存。

从 PathBuf 的拥有实例创建一个写时克隆指针。

此转换不会克隆或分配。

通过将 PathBuf 数据移动到新的 Arc 缓冲区,将 PathBuf 转换为 Arc。

通过将 PathBuf 数据移动到新的 Rc 缓冲区,将 PathBuf 转换为 Rc。

将 String 转换为 PathBuf

此转换不会分配或复制内存。

从迭代器创建一个值。 Read more

可以从解析中返回的相关错误。

解析字符串 s 以返回此类型的值。 Read more

将该值输入给定的 Hasher。 Read more

将这种类型的切片送入给定的 Hasher 中。 Read more

被迭代的元素的类型。

我们将其变成哪种迭代器?

从一个值创建一个迭代器。 Read more

此方法返回 self 和 other 之间的 Ordering。 Read more

比较并返回两个值中的最大值。 Read more

比较并返回两个值中的最小值。 Read more

将值限制为一定的时间间隔。 Read more

此方法测试 self 和 other 值是否相等,并由 == 使用。 Read more

此方法测试 !=。

此方法测试 self 和 other 值是否相等,并由 == 使用。 Read more

此方法测试 !=。

此方法测试 self 和 other 值是否相等,并由 == 使用。 Read more

此方法测试 !=。

此方法测试 self 和 other 值是否相等,并由 == 使用。 Read more

此方法测试 !=。

此方法测试 self 和 other 值是否相等,并由 == 使用。 Read more

此方法测试 !=。

此方法测试 self 和 other 值是否相等,并由 == 使用。 Read more

此方法测试 !=。

此方法测试 self 和 other 值是否相等,并由 == 使用。 Read more

此方法测试 !=。

此方法测试 self 和 other 值是否相等,并由 == 使用。 Read more

此方法测试 !=。

此方法测试 self 和 other 值是否相等,并由 == 使用。 Read more

此方法测试 !=。

此方法测试 self 和 other 值是否相等,并由 == 使用。 Read more

此方法测试 !=。

此方法测试 self 和 other 值是否相等,并由 == 使用。 Read more

此方法测试 !=。

此方法测试 self 和 other 值是否相等,并由 == 使用。 Read more

此方法测试 !=。

此方法测试 self 和 other 值是否相等,并由 == 使用。 Read more

此方法测试 !=。

此方法测试 self 和 other 值是否相等,并由 == 使用。 Read more

此方法测试 !=。

此方法测试 self 和 other 值是否相等,并由 == 使用。 Read more

此方法测试 !=。

如果存在,则此方法返回 self 和 other 值之间的顺序。 Read more

此方法测试的内容少于 (对于 self 和 other),并且由 < 操作员使用。 Read more

此方法测试小于或等于 (对于 self 和 other),并且由 <= 运算符使用。 Read more

此方法测试大于 (对于 self 和 other),并且由 > 操作员使用。 Read more

此方法测试是否大于或等于 (对于 self 和 other),并且由 >= 运算符使用。 Read more

如果存在,则此方法返回 self 和 other 值之间的顺序。 Read more

此方法测试的内容少于 (对于 self 和 other),并且由 < 操作员使用。 Read more

此方法测试小于或等于 (对于 self 和 other),并且由 <= 运算符使用。 Read more

此方法测试大于 (对于 self 和 other),并且由 > 操作员使用。 Read more

此方法测试是否大于或等于 (对于 self 和 other),并且由 >= 运算符使用。 Read more

如果存在,则此方法返回 self 和 other 值之间的顺序。 Read more

此方法测试的内容少于 (对于 self 和 other),并且由 < 操作员使用。 Read more

此方法测试小于或等于 (对于 self 和 other),并且由 <= 运算符使用。 Read more

此方法测试大于 (对于 self 和 other),并且由 > 操作员使用。 Read more

此方法测试是否大于或等于 (对于 self 和 other),并且由 >= 运算符使用。 Read more

如果存在,则此方法返回 self 和 other 值之间的顺序。 Read more

此方法测试的内容少于 (对于 self 和 other),并且由 < 操作员使用。 Read more

此方法测试小于或等于 (对于 self 和 other),并且由 <= 运算符使用。 Read more

此方法测试大于 (对于 self 和 other),并且由 > 操作员使用。 Read more

此方法测试是否大于或等于 (对于 self 和 other),并且由 >= 运算符使用。 Read more

如果存在,则此方法返回 self 和 other 值之间的顺序。 Read more

此方法测试的内容少于 (对于 self 和 other),并且由 < 操作员使用。 Read more

此方法测试小于或等于 (对于 self 和 other),并且由 <= 运算符使用。 Read more

此方法测试大于 (对于 self 和 other),并且由 > 操作员使用。 Read more

此方法测试是否大于或等于 (对于 self 和 other),并且由 >= 运算符使用。 Read more

如果存在,则此方法返回 self 和 other 值之间的顺序。 Read more

此方法测试的内容少于 (对于 self 和 other),并且由 < 操作员使用。 Read more

此方法测试小于或等于 (对于 self 和 other),并且由 <= 运算符使用。 Read more

此方法测试大于 (对于 self 和 other),并且由 > 操作员使用。 Read more

此方法测试是否大于或等于 (对于 self 和 other),并且由 >= 运算符使用。 Read more

如果存在,则此方法返回 self 和 other 值之间的顺序。 Read more

此方法测试的内容少于 (对于 self 和 other),并且由 < 操作员使用。 Read more

此方法测试小于或等于 (对于 self 和 other),并且由 <= 运算符使用。 Read more

此方法测试大于 (对于 self 和 other),并且由 > 操作员使用。 Read more

此方法测试是否大于或等于 (对于 self 和 other),并且由 >= 运算符使用。 Read more

如果存在,则此方法返回 self 和 other 值之间的顺序。 Read more

此方法测试的内容少于 (对于 self 和 other),并且由 < 操作员使用。 Read more

此方法测试小于或等于 (对于 self 和 other),并且由 <= 运算符使用。 Read more

此方法测试大于 (对于 self 和 other),并且由 > 操作员使用。 Read more

此方法测试是否大于或等于 (对于 self 和 other),并且由 >= 运算符使用。 Read more

如果存在,则此方法返回 self 和 other 值之间的顺序。 Read more

此方法测试的内容少于 (对于 self 和 other),并且由 < 操作员使用。 Read more

此方法测试小于或等于 (对于 self 和 other),并且由 <= 运算符使用。 Read more

此方法测试大于 (对于 self 和 other),并且由 > 操作员使用。 Read more

此方法测试是否大于或等于 (对于 self 和 other),并且由 >= 运算符使用。 Read more

如果存在,则此方法返回 self 和 other 值之间的顺序。 Read more

此方法测试的内容少于 (对于 self 和 other),并且由 < 操作员使用。 Read more

此方法测试小于或等于 (对于 self 和 other),并且由 <= 运算符使用。 Read more

此方法测试大于 (对于 self 和 other),并且由 > 操作员使用。 Read more

此方法测试是否大于或等于 (对于 self 和 other),并且由 >= 运算符使用。 Read more

如果存在,则此方法返回 self 和 other 值之间的顺序。 Read more

此方法测试的内容少于 (对于 self 和 other),并且由 < 操作员使用。 Read more

此方法测试小于或等于 (对于 self 和 other),并且由 <= 运算符使用。 Read more

此方法测试大于 (对于 self 和 other),并且由 > 操作员使用。 Read more

此方法测试是否大于或等于 (对于 self 和 other),并且由 >= 运算符使用。 Read more

如果存在,则此方法返回 self 和 other 值之间的顺序。 Read more

此方法测试的内容少于 (对于 self 和 other),并且由 < 操作员使用。 Read more

此方法测试小于或等于 (对于 self 和 other),并且由 <= 运算符使用。 Read more

此方法测试大于 (对于 self 和 other),并且由 > 操作员使用。 Read more

此方法测试是否大于或等于 (对于 self 和 other),并且由 >= 运算符使用。 Read more

如果存在,则此方法返回 self 和 other 值之间的顺序。 Read more

此方法测试的内容少于 (对于 self 和 other),并且由 < 操作员使用。 Read more

此方法测试小于或等于 (对于 self 和 other),并且由 <= 运算符使用。 Read more

此方法测试大于 (对于 self 和 other),并且由 > 操作员使用。 Read more

此方法测试是否大于或等于 (对于 self 和 other),并且由 >= 运算符使用。 Read more

如果存在,则此方法返回 self 和 other 值之间的顺序。 Read more

此方法测试的内容少于 (对于 self 和 other),并且由 < 操作员使用。 Read more

此方法测试小于或等于 (对于 self 和 other),并且由 <= 运算符使用。 Read more

此方法测试大于 (对于 self 和 other),并且由 > 操作员使用。 Read more

此方法测试是否大于或等于 (对于 self 和 other),并且由 >= 运算符使用。 Read more

如果存在,则此方法返回 self 和 other 值之间的顺序。 Read more

此方法测试的内容少于 (对于 self 和 other),并且由 < 操作员使用。 Read more

此方法测试小于或等于 (对于 self 和 other),并且由 <= 运算符使用。 Read more

此方法测试大于 (对于 self 和 other),并且由 > 操作员使用。 Read more

此方法测试是否大于或等于 (对于 self 和 other),并且由 >= 运算符使用。 Read more

Auto Trait Implementations

Blanket Implementations

获取 self 的 TypeId。 Read more

从拥有的值中一成不变地借用。 Read more

从拥有的值中借用。 Read more

执行转换。

执行转换。

获得所有权后的结果类型。

通常通过克隆从借用数据中创建拥有的数据。 Read more

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

recently added

使用借来的数据来替换拥有的数据,通常是通过克隆。 Read more

发生转换错误时返回的类型。

执行转换。

发生转换错误时返回的类型。

执行转换。