pub trait PathExt: Send {
Show 89 methods
// Required methods
fn base(&self) -> Result<&Path>;
fn with_base(&self, base: impl AsRef<Path>) -> Cow<'_, Path>;
fn file_suffix(&self) -> Option<&OsStr>;
fn absolute(&self) -> Result<PathBuf>;
fn metadata_async(&self) -> impl Future<Output = Result<Metadata>> + Send;
fn symlink_metadata_async(
&self,
) -> impl Future<Output = Result<Metadata>> + Send;
fn canonicalize_async(&self) -> impl Future<Output = Result<PathBuf>> + Send;
fn read_link_async(&self) -> impl Future<Output = Result<PathBuf>> + Send;
fn read_dir_async(&self) -> impl Future<Output = Result<ReadDir>> + Send;
fn exists_async(&self) -> impl Future<Output = bool> + Send;
fn is_file_async(&self) -> impl Future<Output = bool> + Send;
fn is_dir_async(&self) -> impl Future<Output = bool> + Send;
fn is_symlink_async(&self) -> impl Future<Output = bool> + Send;
fn try_exists_async(&self) -> impl Future<Output = Result<bool>> + Send;
fn try_is_file(&self) -> impl Future<Output = Result<bool>> + Send;
fn try_is_dir(&self) -> impl Future<Output = Result<bool>> + Send;
fn try_is_symlink(&self) -> impl Future<Output = Result<bool>> + Send;
fn metadata_if_exists(
&self,
) -> impl Future<Output = Result<Option<Metadata>>> + Send;
fn symlink_metadata_if_exists(
&self,
) -> impl Future<Output = Result<Option<Metadata>>> + Send;
fn canonicalize_if_exists(
&self,
) -> impl Future<Output = Result<Option<PathBuf>>> + Send;
fn read_link_if_exists(
&self,
) -> impl Future<Output = Result<Option<PathBuf>>> + Send;
fn read_dir_if_exists(
&self,
) -> impl Future<Output = Result<Option<ReadDir>>> + Send;
fn exists_nofollow(&self) -> impl Future<Output = bool> + Send;
fn is_file_nofollow(&self) -> impl Future<Output = bool> + Send;
fn is_dir_nofollow(&self) -> impl Future<Output = bool> + Send;
fn try_exists_nofollow(&self) -> impl Future<Output = Result<bool>> + Send;
fn try_is_file_nofollow(&self) -> impl Future<Output = Result<bool>> + Send;
fn try_is_dir_nofollow(&self) -> impl Future<Output = Result<bool>> + Send;
fn try_is_read_link_broken(
&self,
) -> impl Future<Output = Result<bool>> + Send;
fn try_is_read_link_broken_if_exists(
&self,
) -> impl Future<Output = Result<Option<bool>>> + Send;
fn try_is_read_dir_empty(&self) -> impl Future<Output = Result<bool>> + Send;
fn try_is_read_dir_empty_if_exists(
&self,
) -> impl Future<Output = Result<Option<bool>>> + Send;
fn create_new(&self) -> impl Future<Output = Result<File>> + Send;
fn create_new_if_not_exists(
&self,
) -> impl Future<Output = Result<Option<File>>> + Send;
fn create(&self) -> impl Future<Output = Result<File>> + Send;
fn create_if_not_exists(
&self,
) -> impl Future<Output = Result<Option<File>>> + Send;
fn open(&self) -> impl Future<Output = Result<File>> + Send;
fn open_if_exists(
&self,
) -> impl Future<Output = Result<Option<File>>> + Send;
fn read(&self) -> impl Future<Output = Result<Vec<u8>>> + Send;
fn read_if_exists(
&self,
) -> impl Future<Output = Result<Option<Vec<u8>>>> + Send;
fn read_to_string(&self) -> impl Future<Output = Result<String>> + Send;
fn read_to_string_if_exists(
&self,
) -> impl Future<Output = Result<Option<String>>> + Send;
fn read_lines(
&self,
) -> impl Future<Output = Result<Lines<BufReader<File>>>> + Send;
fn read_lines_if_exists(
&self,
) -> impl Future<Output = Result<Option<Lines<BufReader<File>>>>> + Send;
fn create_dir_all(self) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn create_dir(self) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn create_dir_if_not_exists(
self,
) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized;
fn write_new(
self,
contents: impl AsRef<[u8]> + Send,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn write_new_if_not_exists(
self,
contents: impl AsRef<[u8]> + Send,
) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized;
fn write(
self,
contents: impl AsRef<[u8]> + Send,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn write_if_exists(
self,
contents: impl AsRef<[u8]> + Send,
) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized;
fn append(
self,
contents: impl AsRef<[u8]> + Send,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn append_if_exists(
self,
contents: impl AsRef<[u8]> + Send,
) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized;
fn copy(
self,
to: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn copy_if_exists(
self,
to: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized;
fn rename(
self,
to: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn rename_if_exists(
self,
to: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized;
fn remove_file(self) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn remove_file_if_exists(
self,
) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized;
fn remove_dir(self) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn remove_dir_if_exists(
self,
) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized;
fn remove_dir_all(self) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn remove_dir_all_if_exists(
self,
) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized;
fn hard_link(
self,
link: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn hard_link_if_exists(
self,
link: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized;
fn hard_link_atomic(
self,
link: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn hard_link_atomic_if_exists(
self,
link: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized;
fn symlink(
self,
link: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn symlink_atomic(
self,
link: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn symlink_absolute(
self,
link: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn symlink_absolute_atomic(
self,
link: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn symlink_relative(
self,
link: impl AsRef<Path> + Send + Sync,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn symlink_relative_atomic(
self,
link: impl AsRef<Path> + Send + Sync,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn set_permissions(
self,
perm: Permissions,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn set_permissions_if_exists(
self,
perm: Permissions,
) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized;
fn set_permissions_readonly(
self,
readonly: bool,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn set_permissions_readonly_if_exists(
self,
readonly: bool,
) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized;
fn set_permissions_mode(
self,
mode: u32,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn set_permissions_mode_if_exists(
self,
mode: u32,
) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized;
fn add_permissions_mode(
self,
mode: u32,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn add_permissions_mode_if_exists(
self,
mode: u32,
) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized;
fn remove_permissions_mode(
self,
mode: u32,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn remove_permissions_mode_if_exists(
self,
mode: u32,
) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized;
fn chown(
self,
uid: Option<u32>,
gid: Option<u32>,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn chown_if_exists(
self,
uid: Option<u32>,
gid: Option<u32>,
) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized;
fn chown_nofollow(
self,
uid: Option<u32>,
gid: Option<u32>,
) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn chown_nofollow_if_exists(
self,
uid: Option<u32>,
gid: Option<u32>,
) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized;
fn chroot(self) -> impl Future<Output = Result<Self>> + Send
where Self: Sized;
fn chroot_if_exists(
self,
) -> impl Future<Output = Result<Option<Self>>> + Send
where Self: Sized;
}Available on crate feature
tokio only.Required Methods§
fn base(&self) -> Result<&Path>
fn with_base(&self, base: impl AsRef<Path>) -> Cow<'_, Path>
fn file_suffix(&self) -> Option<&OsStr>
fn absolute(&self) -> Result<PathBuf>
fn metadata_async(&self) -> impl Future<Output = Result<Metadata>> + Send
fn symlink_metadata_async( &self, ) -> impl Future<Output = Result<Metadata>> + Send
fn canonicalize_async(&self) -> impl Future<Output = Result<PathBuf>> + Send
fn read_link_async(&self) -> impl Future<Output = Result<PathBuf>> + Send
fn read_dir_async(&self) -> impl Future<Output = Result<ReadDir>> + Send
fn exists_async(&self) -> impl Future<Output = bool> + Send
fn is_file_async(&self) -> impl Future<Output = bool> + Send
fn is_dir_async(&self) -> impl Future<Output = bool> + Send
fn is_symlink_async(&self) -> impl Future<Output = bool> + Send
fn try_exists_async(&self) -> impl Future<Output = Result<bool>> + Send
fn try_is_file(&self) -> impl Future<Output = Result<bool>> + Send
fn try_is_dir(&self) -> impl Future<Output = Result<bool>> + Send
fn try_is_symlink(&self) -> impl Future<Output = Result<bool>> + Send
fn metadata_if_exists( &self, ) -> impl Future<Output = Result<Option<Metadata>>> + Send
fn symlink_metadata_if_exists( &self, ) -> impl Future<Output = Result<Option<Metadata>>> + Send
fn canonicalize_if_exists( &self, ) -> impl Future<Output = Result<Option<PathBuf>>> + Send
fn read_link_if_exists( &self, ) -> impl Future<Output = Result<Option<PathBuf>>> + Send
fn read_dir_if_exists( &self, ) -> impl Future<Output = Result<Option<ReadDir>>> + Send
fn exists_nofollow(&self) -> impl Future<Output = bool> + Send
fn is_file_nofollow(&self) -> impl Future<Output = bool> + Send
fn is_dir_nofollow(&self) -> impl Future<Output = bool> + Send
fn try_exists_nofollow(&self) -> impl Future<Output = Result<bool>> + Send
fn try_is_file_nofollow(&self) -> impl Future<Output = Result<bool>> + Send
fn try_is_dir_nofollow(&self) -> impl Future<Output = Result<bool>> + Send
fn try_is_read_link_broken(&self) -> impl Future<Output = Result<bool>> + Send
fn try_is_read_link_broken_if_exists( &self, ) -> impl Future<Output = Result<Option<bool>>> + Send
fn try_is_read_dir_empty(&self) -> impl Future<Output = Result<bool>> + Send
fn try_is_read_dir_empty_if_exists( &self, ) -> impl Future<Output = Result<Option<bool>>> + Send
fn create_new(&self) -> impl Future<Output = Result<File>> + Send
fn create_new_if_not_exists( &self, ) -> impl Future<Output = Result<Option<File>>> + Send
fn create(&self) -> impl Future<Output = Result<File>> + Send
fn create_if_not_exists( &self, ) -> impl Future<Output = Result<Option<File>>> + Send
fn open(&self) -> impl Future<Output = Result<File>> + Send
fn open_if_exists(&self) -> impl Future<Output = Result<Option<File>>> + Send
fn read(&self) -> impl Future<Output = Result<Vec<u8>>> + Send
fn read_if_exists(&self) -> impl Future<Output = Result<Option<Vec<u8>>>> + Send
fn read_to_string(&self) -> impl Future<Output = Result<String>> + Send
fn read_to_string_if_exists( &self, ) -> impl Future<Output = Result<Option<String>>> + Send
fn read_lines( &self, ) -> impl Future<Output = Result<Lines<BufReader<File>>>> + Send
fn read_lines_if_exists( &self, ) -> impl Future<Output = Result<Option<Lines<BufReader<File>>>>> + Send
fn create_dir_all(self) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
fn create_dir(self) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
fn create_dir_if_not_exists(
self,
) -> impl Future<Output = Result<Option<Self>>> + Sendwhere
Self: Sized,
fn write_new(
self,
contents: impl AsRef<[u8]> + Send,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
fn write_new_if_not_exists(
self,
contents: impl AsRef<[u8]> + Send,
) -> impl Future<Output = Result<Option<Self>>> + Sendwhere
Self: Sized,
fn write(
self,
contents: impl AsRef<[u8]> + Send,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
fn write_if_exists(
self,
contents: impl AsRef<[u8]> + Send,
) -> impl Future<Output = Result<Option<Self>>> + Sendwhere
Self: Sized,
fn append(
self,
contents: impl AsRef<[u8]> + Send,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
fn append_if_exists(
self,
contents: impl AsRef<[u8]> + Send,
) -> impl Future<Output = Result<Option<Self>>> + Sendwhere
Self: Sized,
fn copy(
self,
to: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
fn copy_if_exists(
self,
to: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Option<Self>>> + Sendwhere
Self: Sized,
fn rename(
self,
to: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
fn rename_if_exists(
self,
to: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Option<Self>>> + Sendwhere
Self: Sized,
fn remove_file(self) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
fn remove_file_if_exists(
self,
) -> impl Future<Output = Result<Option<Self>>> + Sendwhere
Self: Sized,
fn remove_dir(self) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
fn remove_dir_if_exists(
self,
) -> impl Future<Output = Result<Option<Self>>> + Sendwhere
Self: Sized,
fn remove_dir_all(self) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
fn remove_dir_all_if_exists(
self,
) -> impl Future<Output = Result<Option<Self>>> + Sendwhere
Self: Sized,
fn hard_link(
self,
link: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
fn hard_link_if_exists(
self,
link: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Option<Self>>> + Sendwhere
Self: Sized,
fn hard_link_atomic(
self,
link: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
fn hard_link_atomic_if_exists(
self,
link: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Option<Self>>> + Sendwhere
Self: Sized,
fn symlink(
self,
link: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
Available on Unix only.
fn symlink_atomic(
self,
link: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
Available on Unix only.
fn symlink_absolute(
self,
link: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
Available on Unix only.
fn symlink_absolute_atomic(
self,
link: impl AsRef<Path> + Send,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
Available on Unix only.
fn symlink_relative(
self,
link: impl AsRef<Path> + Send + Sync,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
Available on Unix only.
fn symlink_relative_atomic(
self,
link: impl AsRef<Path> + Send + Sync,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
Available on Unix only.
fn set_permissions(
self,
perm: Permissions,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
fn set_permissions_if_exists(
self,
perm: Permissions,
) -> impl Future<Output = Result<Option<Self>>> + Sendwhere
Self: Sized,
fn set_permissions_readonly(
self,
readonly: bool,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
fn set_permissions_readonly_if_exists(
self,
readonly: bool,
) -> impl Future<Output = Result<Option<Self>>> + Sendwhere
Self: Sized,
fn set_permissions_mode(
self,
mode: u32,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
Available on Unix only.
fn set_permissions_mode_if_exists(
self,
mode: u32,
) -> impl Future<Output = Result<Option<Self>>> + Sendwhere
Self: Sized,
Available on Unix only.
fn add_permissions_mode(
self,
mode: u32,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
Available on Unix only.
fn add_permissions_mode_if_exists(
self,
mode: u32,
) -> impl Future<Output = Result<Option<Self>>> + Sendwhere
Self: Sized,
Available on Unix only.
fn remove_permissions_mode(
self,
mode: u32,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
Available on Unix only.
fn remove_permissions_mode_if_exists(
self,
mode: u32,
) -> impl Future<Output = Result<Option<Self>>> + Sendwhere
Self: Sized,
Available on Unix only.
fn chown(
self,
uid: Option<u32>,
gid: Option<u32>,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
Available on Unix only.
fn chown_if_exists(
self,
uid: Option<u32>,
gid: Option<u32>,
) -> impl Future<Output = Result<Option<Self>>> + Sendwhere
Self: Sized,
Available on Unix only.
fn chown_nofollow(
self,
uid: Option<u32>,
gid: Option<u32>,
) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
Available on Unix only.
fn chown_nofollow_if_exists(
self,
uid: Option<u32>,
gid: Option<u32>,
) -> impl Future<Output = Result<Option<Self>>> + Sendwhere
Self: Sized,
Available on Unix only.
fn chroot(self) -> impl Future<Output = Result<Self>> + Sendwhere
Self: Sized,
Available on Unix and non-Fuchsia only.
fn chroot_if_exists(self) -> impl Future<Output = Result<Option<Self>>> + Sendwhere
Self: Sized,
Available on Unix and non-Fuchsia only.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".