зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1785002 - Update fs-err to 2.8.1. r=emilio,supply-chain-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D155327
This commit is contained in:
Родитель
b3dc37a4fb
Коммит
b7b2893f0b
|
@ -1831,9 +1831,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "fs-err"
|
||||
version = "2.7.0"
|
||||
version = "2.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5bd79fa345a495d3ae89fb7165fec01c0e72f41821d642dda363a1e97975652e"
|
||||
checksum = "64db3e262960f0662f43a6366788d5f10f7f244b8f7d7d987f560baf5ded5c50"
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-zircon"
|
||||
|
|
|
@ -300,6 +300,11 @@ criteria = "safe-to-deploy"
|
|||
version = "1.0.7"
|
||||
notes = "Simple hasher implementation with no unsafe code."
|
||||
|
||||
[[audits.fs-err]]
|
||||
who = "Mike Hommey <mh+mozilla@glandium.org>"
|
||||
criteria = "safe-to-deploy"
|
||||
delta = "2.7.0 -> 2.8.1"
|
||||
|
||||
[[audits.futures]]
|
||||
who = "Mike Hommey <mh+mozilla@glandium.org>"
|
||||
criteria = "safe-to-deploy"
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"CHANGELOG.md":"760e67053af6d1891945c956788fcb6b5d1f51be3648418bb496c15ffddec7e1","Cargo.toml":"ca47eece3e5ccf587b84d838f132e575620f0e56e5b16a0e48807d3c916da6cc","LICENSE-APACHE":"7cfd738c53d61c79f07e348f622bf7707c9084237054d37fbe07788a75f5881c","LICENSE-MIT":"36516aefdc84c5d5a1e7485425913a22dbda69eb1930c5e84d6ae4972b5194b9","README.md":"adbf428f33a04028cc8db98d7b75bdcf28d0edb5e792867578bcb93f1784abec","src/dir.rs":"df350e3fd4936bb1c48652a722b0fabc0e2aebf413f684d78d76f06236ce1f86","src/errors.rs":"f04771790f55627fdc39de43a1d16f7d0125bbf48d4a1c8a70921f2670dd3eaa","src/file.rs":"9649380ca77279cdd55d25c940c8ee5f148128d9ba0f5f147f67ba43e84e2b8d","src/lib.rs":"a1a4e4adf5603bc83b421be386b42ee172729de40b0c323b70d389983f0f3ee4","src/open_options.rs":"304c5be36b5a6c5ecc2c731e2956627494945d093952c879d8f3c5b15216b1d0","src/os.rs":"54fe6cb71a24592de1cb4e1fcebdeaba5e58b26925dbf2dc868e8dd0b0a7bef7","src/os/unix.rs":"21ab862305b9e1034c41bb4be31b1f3d43e3d208ca3e622211b6b54d1bbd9acc","src/os/windows.rs":"4cf0530becb6fed439f469e1f22f57de9ae2ac15e39f2a973f4734aee6267ed0","src/path.rs":"a026ae234184ed1bbadd9051099e201c3ac6309b1fd939d1b2d2b2a7cb82230d"},"package":"5bd79fa345a495d3ae89fb7165fec01c0e72f41821d642dda363a1e97975652e"}
|
||||
{"files":{"CHANGELOG.md":"fb2609e5837d71e923def1765b6addc4d11b0b5040e7eb9bdbf50d59a4a5cd42","Cargo.toml":"b468e8d560ea6e30277c2ee438ac650bbb2397f5b62da911126c180921aa5d29","LICENSE-APACHE":"7cfd738c53d61c79f07e348f622bf7707c9084237054d37fbe07788a75f5881c","LICENSE-MIT":"36516aefdc84c5d5a1e7485425913a22dbda69eb1930c5e84d6ae4972b5194b9","README.md":"adbf428f33a04028cc8db98d7b75bdcf28d0edb5e792867578bcb93f1784abec","src/dir.rs":"c5255382d7357f2fbcb0b45325a343277d347f0dd0b5f0e5ff74cb808020795d","src/errors.rs":"f04771790f55627fdc39de43a1d16f7d0125bbf48d4a1c8a70921f2670dd3eaa","src/file.rs":"4516834bc52f1219f10e369bf570fd432493ceaf5d52d239d93a5e69ceaed0aa","src/lib.rs":"1a10c04bde2bc3ae30cc328afb0aa00ac98ab80c6bfff5ae94ee7e5bdbe86ec8","src/open_options.rs":"304c5be36b5a6c5ecc2c731e2956627494945d093952c879d8f3c5b15216b1d0","src/os.rs":"54fe6cb71a24592de1cb4e1fcebdeaba5e58b26925dbf2dc868e8dd0b0a7bef7","src/os/unix.rs":"21ab862305b9e1034c41bb4be31b1f3d43e3d208ca3e622211b6b54d1bbd9acc","src/os/windows.rs":"4cf0530becb6fed439f469e1f22f57de9ae2ac15e39f2a973f4734aee6267ed0","src/path.rs":"a026ae234184ed1bbadd9051099e201c3ac6309b1fd939d1b2d2b2a7cb82230d"},"package":"64db3e262960f0662f43a6366788d5f10f7f244b8f7d7d987f560baf5ded5c50"}
|
|
@ -1,5 +1,13 @@
|
|||
# fs-err Changelog
|
||||
|
||||
## 2.8.1
|
||||
|
||||
* Fixed docs.rs build
|
||||
|
||||
## 2.8.0
|
||||
|
||||
* Implement I/O safety traits (`AsFd`/`AsHandle`, `Into<OwnedFd>`/`Into<OwnedHandle>`) for file. This feature requires Rust 1.63 or later and is gated behind the `io_safety` feature flag. ([#39](https://github.com/andrewhickman/fs-err/pull/39))
|
||||
|
||||
## 2.7.0
|
||||
|
||||
* Implement `From<fs_err::File> for std::fs::File` ([#38](https://github.com/andrewhickman/fs-err/pull/38))
|
||||
|
|
|
@ -12,25 +12,44 @@
|
|||
[package]
|
||||
edition = "2018"
|
||||
name = "fs-err"
|
||||
version = "2.7.0"
|
||||
version = "2.8.1"
|
||||
authors = ["Andrew Hickman <andrew.hickman1@sky.com>"]
|
||||
exclude = [".github", ".gitignore", "README.tpl"]
|
||||
exclude = [
|
||||
".github",
|
||||
".gitignore",
|
||||
"README.tpl",
|
||||
]
|
||||
description = "A drop-in replacement for std::fs with more helpful error messages."
|
||||
documentation = "https://docs.rs/fs-err"
|
||||
readme = "README.md"
|
||||
categories = ["command-line-interface", "filesystem"]
|
||||
categories = [
|
||||
"command-line-interface",
|
||||
"filesystem",
|
||||
]
|
||||
license = "MIT/Apache-2.0"
|
||||
repository = "https://github.com/andrewhickman/fs-err"
|
||||
|
||||
[package.metadata.release]
|
||||
sign-tag = true
|
||||
tag-name = "{{version}}"
|
||||
sign-tag = true
|
||||
|
||||
[[package.metadata.release.pre-release-replacements]]
|
||||
exactly = 1
|
||||
file = "src/lib.rs"
|
||||
replace = "html_root_url = \"https://docs.rs/fs-err/{{version}}/\""
|
||||
search = "html_root_url = \"https://docs\\.rs/fs-err/.*?\""
|
||||
search = 'html_root_url = "https://docs\.rs/fs-err/.*?"'
|
||||
replace = "html_root_url = \"https://docs.rs/fs-err/{{version}}\""
|
||||
exactly = 1
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustdoc-args = [
|
||||
"--cfg",
|
||||
"docsrs",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
|
||||
[dev-dependencies.serde_json]
|
||||
version = "1.0.64"
|
||||
|
||||
[features]
|
||||
io_safety = []
|
||||
|
|
|
@ -1,90 +1,90 @@
|
|||
use std::ffi::OsString;
|
||||
use std::fs;
|
||||
use std::io;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::errors::{Error, ErrorKind};
|
||||
|
||||
/// Wrapper for [`fs::read_dir`](https://doc.rust-lang.org/stable/std/fs/fn.read_dir.html).
|
||||
pub fn read_dir<P: Into<PathBuf>>(path: P) -> io::Result<ReadDir> {
|
||||
let path = path.into();
|
||||
|
||||
match fs::read_dir(&path) {
|
||||
Ok(inner) => Ok(ReadDir { inner, path }),
|
||||
Err(source) => Err(Error::build(source, ErrorKind::ReadDir, path)),
|
||||
}
|
||||
}
|
||||
|
||||
/// Wrapper around [`std::fs::ReadDir`][std::fs::ReadDir] which adds more
|
||||
/// helpful information to all errors.
|
||||
///
|
||||
/// This struct is created via [`fs_err::read_dir`][fs_err::read_dir].
|
||||
///
|
||||
/// [std::fs::ReadDir]: https://doc.rust-lang.org/stable/std/fs/struct.ReadDir.html
|
||||
/// [fs_err::read_dir]: fn.read_dir.html
|
||||
#[derive(Debug)]
|
||||
pub struct ReadDir {
|
||||
inner: fs::ReadDir,
|
||||
path: PathBuf,
|
||||
}
|
||||
|
||||
impl Iterator for ReadDir {
|
||||
type Item = io::Result<DirEntry>;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
Some(
|
||||
self.inner
|
||||
.next()?
|
||||
.map_err(|source| Error::build(source, ErrorKind::ReadDir, &self.path))
|
||||
.map(|inner| DirEntry { inner }),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// Wrapper around [`std::fs::DirEntry`][std::fs::DirEntry] which adds more
|
||||
/// helpful information to all errors.
|
||||
///
|
||||
/// [std::fs::DirEntry]: https://doc.rust-lang.org/stable/std/fs/struct.DirEntry.html
|
||||
#[derive(Debug)]
|
||||
pub struct DirEntry {
|
||||
inner: fs::DirEntry,
|
||||
}
|
||||
|
||||
impl DirEntry {
|
||||
/// Wrapper for [`DirEntry::path`](https://doc.rust-lang.org/stable/std/fs/struct.DirEntry.html#method.path).
|
||||
pub fn path(&self) -> PathBuf {
|
||||
self.inner.path()
|
||||
}
|
||||
|
||||
/// Wrapper for [`DirEntry::metadata`](https://doc.rust-lang.org/stable/std/fs/struct.DirEntry.html#method.metadata).
|
||||
pub fn metadata(&self) -> io::Result<fs::Metadata> {
|
||||
self.inner
|
||||
.metadata()
|
||||
.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::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).
|
||||
pub fn file_name(&self) -> OsString {
|
||||
self.inner.file_name()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
mod unix {
|
||||
use std::os::unix::fs::DirEntryExt;
|
||||
|
||||
use super::*;
|
||||
|
||||
impl DirEntryExt for DirEntry {
|
||||
fn ino(&self) -> u64 {
|
||||
self.inner.ino()
|
||||
}
|
||||
}
|
||||
}
|
||||
use std::ffi::OsString;
|
||||
use std::fs;
|
||||
use std::io;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::errors::{Error, ErrorKind};
|
||||
|
||||
/// Wrapper for [`fs::read_dir`](https://doc.rust-lang.org/stable/std/fs/fn.read_dir.html).
|
||||
pub fn read_dir<P: Into<PathBuf>>(path: P) -> io::Result<ReadDir> {
|
||||
let path = path.into();
|
||||
|
||||
match fs::read_dir(&path) {
|
||||
Ok(inner) => Ok(ReadDir { inner, path }),
|
||||
Err(source) => Err(Error::build(source, ErrorKind::ReadDir, path)),
|
||||
}
|
||||
}
|
||||
|
||||
/// Wrapper around [`std::fs::ReadDir`][std::fs::ReadDir] which adds more
|
||||
/// helpful information to all errors.
|
||||
///
|
||||
/// This struct is created via [`fs_err::read_dir`][fs_err::read_dir].
|
||||
///
|
||||
/// [std::fs::ReadDir]: https://doc.rust-lang.org/stable/std/fs/struct.ReadDir.html
|
||||
/// [fs_err::read_dir]: fn.read_dir.html
|
||||
#[derive(Debug)]
|
||||
pub struct ReadDir {
|
||||
inner: fs::ReadDir,
|
||||
path: PathBuf,
|
||||
}
|
||||
|
||||
impl Iterator for ReadDir {
|
||||
type Item = io::Result<DirEntry>;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
Some(
|
||||
self.inner
|
||||
.next()?
|
||||
.map_err(|source| Error::build(source, ErrorKind::ReadDir, &self.path))
|
||||
.map(|inner| DirEntry { inner }),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// Wrapper around [`std::fs::DirEntry`][std::fs::DirEntry] which adds more
|
||||
/// helpful information to all errors.
|
||||
///
|
||||
/// [std::fs::DirEntry]: https://doc.rust-lang.org/stable/std/fs/struct.DirEntry.html
|
||||
#[derive(Debug)]
|
||||
pub struct DirEntry {
|
||||
inner: fs::DirEntry,
|
||||
}
|
||||
|
||||
impl DirEntry {
|
||||
/// Wrapper for [`DirEntry::path`](https://doc.rust-lang.org/stable/std/fs/struct.DirEntry.html#method.path).
|
||||
pub fn path(&self) -> PathBuf {
|
||||
self.inner.path()
|
||||
}
|
||||
|
||||
/// Wrapper for [`DirEntry::metadata`](https://doc.rust-lang.org/stable/std/fs/struct.DirEntry.html#method.metadata).
|
||||
pub fn metadata(&self) -> io::Result<fs::Metadata> {
|
||||
self.inner
|
||||
.metadata()
|
||||
.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::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).
|
||||
pub fn file_name(&self) -> OsString {
|
||||
self.inner.file_name()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
mod unix {
|
||||
use std::os::unix::fs::DirEntryExt;
|
||||
|
||||
use super::*;
|
||||
|
||||
impl DirEntryExt for DirEntry {
|
||||
fn ino(&self) -> u64 {
|
||||
self.inner.ino()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -284,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)]
|
||||
|
@ -325,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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.7.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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче