summaryrefslogtreecommitdiffstats
path: root/vendor/fs-err/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:31 +0000
commit2ff14448863ac1a1dd9533461708e29aae170c2d (patch)
tree85b9fea2bbfe3f06473cfa381eed11f273b57c5c /vendor/fs-err/src
parentAdding debian version 1.64.0+dfsg1-1. (diff)
downloadrustc-2ff14448863ac1a1dd9533461708e29aae170c2d.tar.xz
rustc-2ff14448863ac1a1dd9533461708e29aae170c2d.zip
Adding debian version 1.65.0+dfsg1-2.debian/1.65.0+dfsg1-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/fs-err/src')
-rw-r--r--vendor/fs-err/src/dir.rs13
-rw-r--r--vendor/fs-err/src/errors.rs30
-rw-r--r--vendor/fs-err/src/file.rs76
-rw-r--r--vendor/fs-err/src/lib.rs43
-rw-r--r--vendor/fs-err/src/open_options.rs1
-rw-r--r--vendor/fs-err/src/os/unix.rs6
-rw-r--r--vendor/fs-err/src/os/windows.rs4
-rw-r--r--vendor/fs-err/src/path.rs2
8 files changed, 116 insertions, 59 deletions
diff --git a/vendor/fs-err/src/dir.rs b/vendor/fs-err/src/dir.rs
index adba643b9..6efa58da6 100644
--- a/vendor/fs-err/src/dir.rs
+++ b/vendor/fs-err/src/dir.rs
@@ -11,7 +11,7 @@ pub fn read_dir<P: Into<PathBuf>>(path: P) -> io::Result<ReadDir> {
match fs::read_dir(&path) {
Ok(inner) => Ok(ReadDir { inner, path }),
- Err(source) => Err(Error::new(source, ErrorKind::ReadDir, path)),
+ Err(source) => Err(Error::build(source, ErrorKind::ReadDir, path)),
}
}
@@ -32,7 +32,12 @@ impl Iterator for ReadDir {
type Item = io::Result<DirEntry>;
fn next(&mut self) -> Option<Self::Item> {
- Some(self.inner.next()?.map(|inner| DirEntry { inner }))
+ Some(
+ self.inner
+ .next()?
+ .map_err(|source| Error::build(source, ErrorKind::ReadDir, &self.path))
+ .map(|inner| DirEntry { inner }),
+ )
}
}
@@ -55,14 +60,14 @@ impl DirEntry {
pub fn metadata(&self) -> io::Result<fs::Metadata> {
self.inner
.metadata()
- .map_err(|source| Error::new(source, ErrorKind::Metadata, self.path()))
+ .map_err(|source| Error::build(source, ErrorKind::Metadata, self.path()))
}
/// Wrapper for [`DirEntry::file_type`](https://doc.rust-lang.org/stable/std/fs/struct.DirEntry.html#method.file_type).
pub fn file_type(&self) -> io::Result<fs::FileType> {
self.inner
.file_type()
- .map_err(|source| Error::new(source, ErrorKind::Metadata, self.path()))
+ .map_err(|source| Error::build(source, ErrorKind::Metadata, self.path()))
}
/// Wrapper for [`DirEntry::file_name`](https://doc.rust-lang.org/stable/std/fs/struct.DirEntry.html#method.file_name).
diff --git a/vendor/fs-err/src/errors.rs b/vendor/fs-err/src/errors.rs
index 466d28f11..43bc4ba42 100644
--- a/vendor/fs-err/src/errors.rs
+++ b/vendor/fs-err/src/errors.rs
@@ -47,12 +47,15 @@ pub(crate) struct Error {
}
impl Error {
- pub fn new(source: io::Error, kind: ErrorKind, path: impl Into<PathBuf>) -> io::Error {
- Self::_new(source, kind, path.into())
- }
-
- fn _new(source: io::Error, kind: ErrorKind, path: PathBuf) -> io::Error {
- io::Error::new(source.kind(), Self { kind, source, path })
+ pub fn build(source: io::Error, kind: ErrorKind, path: impl Into<PathBuf>) -> io::Error {
+ io::Error::new(
+ source.kind(),
+ Self {
+ kind,
+ source,
+ path: path.into(),
+ },
+ )
}
}
@@ -131,28 +134,19 @@ pub(crate) struct SourceDestError {
}
impl SourceDestError {
- pub fn new(
+ pub fn build(
source: io::Error,
kind: SourceDestErrorKind,
from_path: impl Into<PathBuf>,
to_path: impl Into<PathBuf>,
) -> io::Error {
- Self::_new(source, kind, from_path.into(), to_path.into())
- }
-
- fn _new(
- source: io::Error,
- kind: SourceDestErrorKind,
- from_path: PathBuf,
- to_path: PathBuf,
- ) -> io::Error {
io::Error::new(
source.kind(),
Self {
kind,
source,
- from_path,
- to_path,
+ from_path: from_path.into(),
+ to_path: to_path.into(),
},
)
}
diff --git a/vendor/fs-err/src/file.rs b/vendor/fs-err/src/file.rs
index a9c8988e5..fcf54fe3c 100644
--- a/vendor/fs-err/src/file.rs
+++ b/vendor/fs-err/src/file.rs
@@ -17,12 +17,12 @@ pub struct File {
// Opens a std File and returns it or an error generator which only needs the path to produce the error.
// Exists for the `crate::read*` functions so they don't unconditionally build a PathBuf.
pub(crate) fn open(path: &Path) -> Result<std::fs::File, impl FnOnce(PathBuf) -> io::Error> {
- fs::File::open(&path).map_err(|err| |path| Error::new(err, ErrorKind::OpenFile, path))
+ fs::File::open(&path).map_err(|err| |path| Error::build(err, ErrorKind::OpenFile, path))
}
// like `open()` but for `crate::write`
pub(crate) fn create(path: &Path) -> Result<std::fs::File, impl FnOnce(PathBuf) -> io::Error> {
- fs::File::create(&path).map_err(|err| |path| Error::new(err, ErrorKind::CreateFile, path))
+ fs::File::create(&path).map_err(|err| |path| Error::build(err, ErrorKind::CreateFile, path))
}
/// Wrappers for methods from [`std::fs::File`][std::fs::File].
@@ -65,7 +65,7 @@ impl File {
let path = path.into();
match options.open(&path) {
Ok(file) => Ok(File::from_parts(file, path)),
- Err(source) => Err(Error::new(source, ErrorKind::OpenFile, path)),
+ Err(source) => Err(Error::build(source, ErrorKind::OpenFile, path)),
}
}
@@ -114,7 +114,13 @@ impl File {
.set_permissions(perm)
.map_err(|source| self.error(source, ErrorKind::SetPermissions))
}
+}
+/// Methods added by fs-err that are not available on
+/// [`std::fs::File`][std::fs::File].
+///
+/// [std::fs::File]: https://doc.rust-lang.org/stable/std/fs/struct.File.html
+impl File {
/// Creates a [`File`](struct.File.html) from a raw file and its path.
pub fn from_parts<P>(file: fs::File, path: P) -> Self
where
@@ -125,13 +131,12 @@ impl File {
path: path.into(),
}
}
-}
-/// Methods added by fs-err that are not available on
-/// [`std::fs::File`][std::fs::File].
-///
-/// [std::fs::File]: https://doc.rust-lang.org/stable/std/fs/struct.File.html
-impl File {
+ /// Extract the raw file and its path from this [`File`](struct.File.html)
+ pub fn into_parts(self) -> (fs::File, PathBuf) {
+ (self.file, self.path)
+ }
+
/// Returns a reference to the underlying [`std::fs::File`][std::fs::File].
///
/// [std::fs::File]: https://doc.rust-lang.org/stable/std/fs/struct.File.html
@@ -139,6 +144,13 @@ impl File {
&self.file
}
+ /// Returns a mutable reference to the underlying [`std::fs::File`][std::fs::File].
+ ///
+ /// [std::fs::File]: https://doc.rust-lang.org/stable/std/fs/struct.File.html
+ pub fn file_mut(&mut self) -> &mut fs::File {
+ &mut self.file
+ }
+
/// Returns a reference to the path that this file was created with.
pub fn path(&self) -> &Path {
&self.path
@@ -146,7 +158,7 @@ impl File {
/// Wrap the error in information specific to this `File` object.
fn error(&self, source: io::Error, kind: ErrorKind) -> io::Error {
- Error::new(source, kind, &self.path)
+ Error::build(source, kind, &self.path)
}
}
@@ -178,6 +190,12 @@ impl<'a> Read for &'a File {
}
}
+impl From<File> for fs::File {
+ fn from(file: File) -> Self {
+ file.into_parts().0
+ }
+}
+
impl Seek for File {
fn seek(&mut self, pos: std::io::SeekFrom) -> std::io::Result<u64> {
self.file
@@ -266,6 +284,25 @@ mod unix {
.map_err(|err| self.error(err, ErrorKind::WriteAt))
}
}
+
+ #[cfg(feature = "io_safety")]
+ mod io_safety {
+ use std::os::unix::io::{AsFd, BorrowedFd, OwnedFd};
+
+ #[cfg_attr(docsrs, doc(cfg(feature = "io_safety")))]
+ impl AsFd for crate::File {
+ fn as_fd(&self) -> BorrowedFd<'_> {
+ self.file().as_fd()
+ }
+ }
+
+ #[cfg_attr(docsrs, doc(cfg(feature = "io_safety")))]
+ impl From<crate::File> for OwnedFd {
+ fn from(file: crate::File) -> Self {
+ file.into_parts().0.into()
+ }
+ }
+ }
}
#[cfg(windows)]
@@ -307,4 +344,23 @@ mod windows {
self.file.into_raw_handle()
}
}
+
+ #[cfg(feature = "io_safety")]
+ mod io_safety {
+ use std::os::windows::io::{AsHandle, BorrowedHandle, OwnedHandle};
+
+ #[cfg_attr(docsrs, doc(cfg(feature = "io_safety")))]
+ impl AsHandle for crate::File {
+ fn as_handle(&self) -> BorrowedHandle<'_> {
+ self.file().as_handle()
+ }
+ }
+
+ #[cfg_attr(docsrs, doc(cfg(feature = "io_safety")))]
+ impl From<crate::File> for OwnedHandle {
+ fn from(file: crate::File) -> Self {
+ file.into_parts().0.into()
+ }
+ }
+ }
}
diff --git a/vendor/fs-err/src/lib.rs b/vendor/fs-err/src/lib.rs
index 3cc8a3b4d..777db9535 100644
--- a/vendor/fs-err/src/lib.rs
+++ b/vendor/fs-err/src/lib.rs
@@ -1,7 +1,7 @@
/*!
fs-err is a drop-in replacement for [`std::fs`][std::fs] that provides more
helpful messages on errors. Extra information includes which operations was
-attmpted and any involved paths.
+attempted and any involved paths.
# Error Messages
@@ -66,8 +66,9 @@ println!("Program config: {:?}", decoded);
[serde_json]: https://crates.io/crates/serde_json
*/
-#![doc(html_root_url = "https://docs.rs/fs-err/2.5.0")]
+#![doc(html_root_url = "https://docs.rs/fs-err/2.8.1")]
#![deny(missing_debug_implementations, missing_docs)]
+#![cfg_attr(docsrs, feature(doc_cfg))]
mod dir;
mod errors;
@@ -90,20 +91,20 @@ pub use path::PathExt;
/// Wrapper for [`fs::read`](https://doc.rust-lang.org/stable/std/fs/fn.read.html).
pub fn read<P: AsRef<Path>>(path: P) -> io::Result<Vec<u8>> {
let path = path.as_ref();
- let mut file = file::open(path.as_ref()).map_err(|err_gen| err_gen(path.to_path_buf()))?;
+ let mut file = file::open(path).map_err(|err_gen| err_gen(path.to_path_buf()))?;
let mut bytes = Vec::with_capacity(initial_buffer_size(&file));
file.read_to_end(&mut bytes)
- .map_err(|err| Error::new(err, ErrorKind::Read, path))?;
+ .map_err(|err| Error::build(err, ErrorKind::Read, path))?;
Ok(bytes)
}
/// Wrapper for [`fs::read_to_string`](https://doc.rust-lang.org/stable/std/fs/fn.read_to_string.html).
pub fn read_to_string<P: AsRef<Path>>(path: P) -> io::Result<String> {
let path = path.as_ref();
- let mut file = file::open(path.as_ref()).map_err(|err_gen| err_gen(path.to_path_buf()))?;
+ let mut file = file::open(path).map_err(|err_gen| err_gen(path.to_path_buf()))?;
let mut string = String::with_capacity(initial_buffer_size(&file));
file.read_to_string(&mut string)
- .map_err(|err| Error::new(err, ErrorKind::Read, path))?;
+ .map_err(|err| Error::build(err, ErrorKind::Read, path))?;
Ok(string)
}
@@ -113,7 +114,7 @@ pub fn write<P: AsRef<Path>, C: AsRef<[u8]>>(path: P, contents: C) -> io::Result
file::create(path)
.map_err(|err_gen| err_gen(path.to_path_buf()))?
.write_all(contents.as_ref())
- .map_err(|err| Error::new(err, ErrorKind::Write, path))
+ .map_err(|err| Error::build(err, ErrorKind::Write, path))
}
/// Wrapper for [`fs::copy`](https://doc.rust-lang.org/stable/std/fs/fn.copy.html).
@@ -125,7 +126,7 @@ where
let from = from.as_ref();
let to = to.as_ref();
fs::copy(from, to)
- .map_err(|source| SourceDestError::new(source, SourceDestErrorKind::Copy, from, to))
+ .map_err(|source| SourceDestError::build(source, SourceDestErrorKind::Copy, from, to))
}
/// Wrapper for [`fs::create_dir`](https://doc.rust-lang.org/stable/std/fs/fn.create_dir.html).
@@ -134,7 +135,7 @@ where
P: AsRef<Path>,
{
let path = path.as_ref();
- fs::create_dir(path).map_err(|source| Error::new(source, ErrorKind::CreateDir, path))
+ fs::create_dir(path).map_err(|source| Error::build(source, ErrorKind::CreateDir, path))
}
/// Wrapper for [`fs::create_dir_all`](https://doc.rust-lang.org/stable/std/fs/fn.create_dir_all.html).
@@ -143,7 +144,7 @@ where
P: AsRef<Path>,
{
let path = path.as_ref();
- fs::create_dir_all(path).map_err(|source| Error::new(source, ErrorKind::CreateDir, path))
+ fs::create_dir_all(path).map_err(|source| Error::build(source, ErrorKind::CreateDir, path))
}
/// Wrapper for [`fs::remove_dir`](https://doc.rust-lang.org/stable/std/fs/fn.remove_dir.html).
@@ -152,7 +153,7 @@ where
P: AsRef<Path>,
{
let path = path.as_ref();
- fs::remove_dir(path).map_err(|source| Error::new(source, ErrorKind::RemoveDir, path))
+ fs::remove_dir(path).map_err(|source| Error::build(source, ErrorKind::RemoveDir, path))
}
/// Wrapper for [`fs::remove_dir_all`](https://doc.rust-lang.org/stable/std/fs/fn.remove_dir_all.html).
@@ -161,7 +162,7 @@ where
P: AsRef<Path>,
{
let path = path.as_ref();
- fs::remove_dir_all(path).map_err(|source| Error::new(source, ErrorKind::RemoveDir, path))
+ fs::remove_dir_all(path).map_err(|source| Error::build(source, ErrorKind::RemoveDir, path))
}
/// Wrapper for [`fs::remove_file`](https://doc.rust-lang.org/stable/std/fs/fn.remove_file.html).
@@ -170,19 +171,19 @@ where
P: AsRef<Path>,
{
let path = path.as_ref();
- fs::remove_file(path).map_err(|source| Error::new(source, ErrorKind::RemoveFile, path))
+ fs::remove_file(path).map_err(|source| Error::build(source, ErrorKind::RemoveFile, path))
}
/// Wrapper for [`fs::metadata`](https://doc.rust-lang.org/stable/std/fs/fn.metadata.html).
pub fn metadata<P: AsRef<Path>>(path: P) -> io::Result<fs::Metadata> {
let path = path.as_ref();
- fs::metadata(path).map_err(|source| Error::new(source, ErrorKind::Metadata, path))
+ fs::metadata(path).map_err(|source| Error::build(source, ErrorKind::Metadata, path))
}
/// Wrapper for [`fs::canonicalize`](https://doc.rust-lang.org/stable/std/fs/fn.canonicalize.html).
pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
let path = path.as_ref();
- fs::canonicalize(path).map_err(|source| Error::new(source, ErrorKind::Canonicalize, path))
+ fs::canonicalize(path).map_err(|source| Error::build(source, ErrorKind::Canonicalize, path))
}
/// Wrapper for [`fs::hard_link`](https://doc.rust-lang.org/stable/std/fs/fn.hard_link.html).
@@ -190,13 +191,13 @@ pub fn hard_link<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::Result<(
let src = src.as_ref();
let dst = dst.as_ref();
fs::hard_link(src, dst)
- .map_err(|source| SourceDestError::new(source, SourceDestErrorKind::HardLink, src, dst))
+ .map_err(|source| SourceDestError::build(source, SourceDestErrorKind::HardLink, src, dst))
}
/// Wrapper for [`fs::read_link`](https://doc.rust-lang.org/stable/std/fs/fn.read_link.html).
pub fn read_link<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
let path = path.as_ref();
- fs::read_link(path).map_err(|source| Error::new(source, ErrorKind::ReadLink, path))
+ fs::read_link(path).map_err(|source| Error::build(source, ErrorKind::ReadLink, path))
}
/// Wrapper for [`fs::rename`](https://doc.rust-lang.org/stable/std/fs/fn.rename.html).
@@ -204,7 +205,7 @@ pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()>
let from = from.as_ref();
let to = to.as_ref();
fs::rename(from, to)
- .map_err(|source| SourceDestError::new(source, SourceDestErrorKind::Rename, from, to))
+ .map_err(|source| SourceDestError::build(source, SourceDestErrorKind::Rename, from, to))
}
/// Wrapper for [`fs::soft_link`](https://doc.rust-lang.org/stable/std/fs/fn.soft_link.html).
@@ -215,21 +216,21 @@ pub fn soft_link<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::Result<(
let dst = dst.as_ref();
#[allow(deprecated)]
fs::soft_link(src, dst)
- .map_err(|source| SourceDestError::new(source, SourceDestErrorKind::SoftLink, src, dst))
+ .map_err(|source| SourceDestError::build(source, SourceDestErrorKind::SoftLink, src, dst))
}
/// Wrapper for [`fs::symlink_metadata`](https://doc.rust-lang.org/stable/std/fs/fn.symlink_metadata.html).
pub fn symlink_metadata<P: AsRef<Path>>(path: P) -> io::Result<fs::Metadata> {
let path = path.as_ref();
fs::symlink_metadata(path)
- .map_err(|source| Error::new(source, ErrorKind::SymlinkMetadata, path))
+ .map_err(|source| Error::build(source, ErrorKind::SymlinkMetadata, path))
}
/// Wrapper for [`fs::set_permissions`](https://doc.rust-lang.org/stable/std/fs/fn.set_permissions.html).
pub fn set_permissions<P: AsRef<Path>>(path: P, perm: fs::Permissions) -> io::Result<()> {
let path = path.as_ref();
fs::set_permissions(path, perm)
- .map_err(|source| Error::new(source, ErrorKind::SetPermissions, path))
+ .map_err(|source| Error::build(source, ErrorKind::SetPermissions, path))
}
fn initial_buffer_size(file: &std::fs::File) -> usize {
diff --git a/vendor/fs-err/src/open_options.rs b/vendor/fs-err/src/open_options.rs
index 2a11a3974..557fa7abe 100644
--- a/vendor/fs-err/src/open_options.rs
+++ b/vendor/fs-err/src/open_options.rs
@@ -5,6 +5,7 @@ pub struct OpenOptions(fs::OpenOptions);
impl OpenOptions {
/// Wrapper for [`std::fs::OpenOptions::new`](https://doc.rust-lang.org/std/fs/struct.OpenOptions.html#method.new)
+ #[allow(clippy::new_without_default)]
pub fn new() -> Self {
OpenOptions(fs::OpenOptions::new())
}
diff --git a/vendor/fs-err/src/os/unix.rs b/vendor/fs-err/src/os/unix.rs
index 1c0bbc24d..ad7c488c4 100644
--- a/vendor/fs-err/src/os/unix.rs
+++ b/vendor/fs-err/src/os/unix.rs
@@ -11,7 +11,7 @@ pub mod fs {
let src = src.as_ref();
let dst = dst.as_ref();
std::os::unix::fs::symlink(src, dst)
- .map_err(|err| SourceDestError::new(err, SourceDestErrorKind::Symlink, src, dst))
+ .map_err(|err| SourceDestError::build(err, SourceDestErrorKind::Symlink, src, dst))
}
/// Wrapper for [`std::os::unix::fs::FileExt`](https://doc.rust-lang.org/std/os/unix/fs/trait.FileExt.html).
@@ -30,9 +30,9 @@ pub mod fs {
/// The std traits might be extended in the future (See issue [#49961](https://github.com/rust-lang/rust/issues/49961#issuecomment-382751777)).
/// This trait is sealed and can not be implemented by other crates.
pub trait OpenOptionsExt: crate::Sealed {
- /// Wapper for [`OpenOptionsExt::mode`](https://doc.rust-lang.org/std/os/unix/fs/trait.OpenOptionsExt.html#tymethod.mode)
+ /// Wrapper for [`OpenOptionsExt::mode`](https://doc.rust-lang.org/std/os/unix/fs/trait.OpenOptionsExt.html#tymethod.mode)
fn mode(&mut self, mode: u32) -> &mut Self;
- /// Wapper for [`OpenOptionsExt::custom_flags`](https://doc.rust-lang.org/std/os/unix/fs/trait.OpenOptionsExt.html#tymethod.custom_flags)
+ /// Wrapper for [`OpenOptionsExt::custom_flags`](https://doc.rust-lang.org/std/os/unix/fs/trait.OpenOptionsExt.html#tymethod.custom_flags)
fn custom_flags(&mut self, flags: i32) -> &mut Self;
}
}
diff --git a/vendor/fs-err/src/os/windows.rs b/vendor/fs-err/src/os/windows.rs
index 3aaa4a2b8..f55985623 100644
--- a/vendor/fs-err/src/os/windows.rs
+++ b/vendor/fs-err/src/os/windows.rs
@@ -8,7 +8,7 @@ pub mod fs {
let src = src.as_ref();
let dst = dst.as_ref();
std::os::windows::fs::symlink_dir(src, dst)
- .map_err(|err| SourceDestError::new(err, SourceDestErrorKind::SymlinkDir, src, dst))
+ .map_err(|err| SourceDestError::build(err, SourceDestErrorKind::SymlinkDir, src, dst))
}
/// Wrapper for [std::os::windows::fs::symlink_file](https://doc.rust-lang.org/std/os/windows/fs/fn.symlink_file.html)
@@ -16,7 +16,7 @@ pub mod fs {
let src = src.as_ref();
let dst = dst.as_ref();
std::os::windows::fs::symlink_file(src, dst)
- .map_err(|err| SourceDestError::new(err, SourceDestErrorKind::SymlinkFile, src, dst))
+ .map_err(|err| SourceDestError::build(err, SourceDestErrorKind::SymlinkFile, src, dst))
}
/// Wrapper for [`std::os::windows::fs::FileExt`](https://doc.rust-lang.org/std/os/windows/fs/trait.FileExt.html).
diff --git a/vendor/fs-err/src/path.rs b/vendor/fs-err/src/path.rs
index ed6b9eaf1..28549a31c 100644
--- a/vendor/fs-err/src/path.rs
+++ b/vendor/fs-err/src/path.rs
@@ -6,7 +6,7 @@ use std::path::{Path, PathBuf};
///
/// This trait is sealed and can not be implemented by other crates.
//
-// Because noone else can implement it, we can add methods backwards-compatibly.
+// Because no one else can implement it, we can add methods backwards-compatibly.
pub trait PathExt: crate::Sealed {
/// Wrapper for [`crate::metadata`].
fn fs_err_metadata(&self) -> io::Result<fs::Metadata>;