Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ jobs:
run: |
cargo update --package=once_cell --precise=1.20.3
cargo update --package=uuid --precise=1.20.0
cargo update --package=async-io --precise=2.5.0
cargo update --package=polling --precise=3.10.0

# Don't use --all-features because some of the features have dependencies
# that don't work on newer Rust versions.
Expand Down
11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ rust-version = "1.70"

[dev-dependencies]
anyhow = "1.0.37"
cap-tokio = { path = "cap-tokio", version = "4.0.2" }
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
cap-fs-ext = { path = "cap-fs-ext", version = "4.0.2" }
cap-net-ext = { path = "cap-net-ext", version = "4.0.2" }
cap-directories = { path = "cap-directories", version = "4.0.2" }
Expand Down Expand Up @@ -54,14 +56,23 @@ fs_utf8 = [
"cap-fs-ext/fs_utf8",
"cap-tempfile/fs_utf8",
]
async_std_fs_utf8 = [
"cap-tokio/fs_utf8",
"cap-fs-ext/async_std_fs_utf8"
]
arf_strings = [
"cap-std/arf_strings",
"cap-fs-ext/arf_strings",
"cap-tempfile/arf_strings",
]
async_std_arf_strings = [
"cap-tokio/arf_strings",
"cap-fs-ext/async_std_arf_strings"
]

[workspace]
members = [
"cap-tokio",
"cap-fs-ext",
"cap-net-ext",
"cap-directories",
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The `cap-std` project is organized around the eponymous [`cap-std`] crate, and
develops libraries to make it easy to write capability-based code, including:

- [`cap-std`] itself, which provides capability-based versions of `std` APIs
- [`cap-tokio`], which is to [`tokio`] what `cap-std` is to `std`
- [`cap-directories`] which provides capability-based access to
[standard application directories]
- [`cap-tempfile`], which provides capability-based access to
Expand Down Expand Up @@ -44,13 +45,15 @@ Linux.
[CWE-22]: https://cwe.mitre.org/data/definitions/22.html
[2021 CWE Top 25 Most Dangerous Software Weaknesses]: https://cwe.mitre.org/top25/archive/2021/2021_cwe_top25.html
[`cap-std`]: https://github.com/bytecodealliance/cap-std/blob/main/cap-std/README.md
[`cap-tokio`]: https://github.com/bytecodealliance/cap-std/blob/main/cap-tokio/README.md
[`cap-directories`]: https://github.com/bytecodealliance/cap-std/blob/main/cap-directories/README.md
[`cap-tempfile`]: https://github.com/bytecodealliance/cap-std/blob/main/cap-tempfile/README.md
[`cap-fs-ext`]: https://github.com/bytecodealliance/cap-std/blob/main/cap-fs-ext/README.md
[`cap-time-ext`]: https://github.com/bytecodealliance/cap-std/blob/main/cap-time-ext/README.md
[`cap-rand`]: https://github.com/bytecodealliance/cap-std/blob/main/cap-rand/README.md
[`cap-net-ext`]: https://github.com/bytecodealliance/cap-std/blob/main/cap-net-ext/README.md
[`cap_std::fs`]: https://docs.rs/cap-std/latest/cap_std/fs/index.html
[`tokio`]: https://docs.rs/tokio/
[standard application directories]: https://docs.rs/directories/
[temporary directories]: https://docs.rs/tempfile/
[random number generators]: https://docs.rs/rand/
Expand Down
6 changes: 6 additions & 0 deletions cap-fs-ext/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,22 @@ edition = "2021"

[dependencies]
arf-strings = { version = "0.7.0", optional = true }
cap-tokio = { path = "../cap-tokio", optional = true, version = "4.0.2" }
cap-std = { path = "../cap-std", optional = true, version = "4.0.2" }
cap-primitives = { path = "../cap-primitives", version = "4.0.2" }
io-lifetimes = { version = "3.0.1", default-features = false }
async-std = { version = "1.13.0", features = ["io_safety", "attributes"], optional = true }
async-trait = { version = "0.1.42", optional = true }
camino = { version = "1.0.5", optional = true }

[features]
default = ["std"]
fs_utf8 = ["cap-std/fs_utf8", "camino"]
arf_strings = ["cap-std/arf_strings", "fs_utf8", "arf-strings"]
std = ["cap-std"]
async_std = ["cap-tokio", "async-std", "io-lifetimes/async-std", "async-trait"]
async_std_fs_utf8 = ["cap-tokio/fs_utf8", "camino"]
async_std_arf_strings = ["cap-tokio/arf_strings", "async_std_fs_utf8", "arf-strings"]

[target.'cfg(windows)'.dependencies.windows-sys]
version = ">=0.60, <0.62"
Expand Down
32 changes: 32 additions & 0 deletions cap-fs-ext/src/dir_entry_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ impl DirEntryExt for cap_std::fs::DirEntry {
}
}

#[cfg(all(not(windows), feature = "async_std"))]
impl DirEntryExt for cap_tokio::fs::DirEntry {
#[inline]
fn full_metadata(&self) -> io::Result<Metadata> {
self.metadata()
}
}

#[cfg(all(windows, feature = "async_std"))]
impl DirEntryExt for cap_tokio::fs::DirEntry {
#[inline]
fn full_metadata(&self) -> io::Result<Metadata> {
_WindowsDirEntryExt::full_metadata(self)
}
}

#[cfg(all(not(windows), feature = "std", feature = "fs_utf8"))]
impl DirEntryExt for cap_std::fs_utf8::DirEntry {
#[inline]
Expand All @@ -54,3 +70,19 @@ impl DirEntryExt for cap_std::fs_utf8::DirEntry {
_WindowsDirEntryExt::full_metadata(self)
}
}

#[cfg(all(not(windows), feature = "async_std", feature = "fs_utf8"))]
impl DirEntryExt for cap_tokio::fs_utf8::DirEntry {
#[inline]
fn full_metadata(&self) -> io::Result<Metadata> {
self.metadata()
}
}

#[cfg(all(windows, feature = "async_std", feature = "fs_utf8"))]
impl DirEntryExt for cap_tokio::fs_utf8::DirEntry {
#[inline]
fn full_metadata(&self) -> io::Result<Metadata> {
_WindowsDirEntryExt::full_metadata(self)
}
}
Loading
Loading