Skip to content

Commit 69c8678

Browse files
committed
Minimal optimization for cap-async-std.
Use `spawn_blocking` to run important blocking tests off the main thread.
1 parent 430e551 commit 69c8678

File tree

11 files changed

+871
-332
lines changed

11 files changed

+871
-332
lines changed

Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ publish = false
1717
rustc_version = "0.3.0"
1818

1919
[dev-dependencies]
20-
async-std = { version = "1.9.0", features = ["attributes"] }
20+
# Use a git dependency until https://github.com/async-rs/async-std/pull/937 is released.
21+
async-std = { git = "https://github.com/async-rs/async-std", features = ["attributes"] }
2122
anyhow = "1.0.37"
2223
cap-async-std = { path = "cap-async-std", version = "^0.13.11-alpha.0"}
2324
cap-fs-ext = { path = "cap-fs-ext", version = "^0.13.11-alpha.0"}
@@ -47,6 +48,10 @@ async_std_fs_utf8 = [
4748
"cap-fs-ext/async_std_fs_utf8"
4849
]
4950

51+
# Patch in a git dependency; see the dependency on async-std above.
52+
[patch.crates-io]
53+
async-std = { git = "https://github.com/async-rs/async-std", features = ["attributes", "unstable"] }
54+
5055
[badges]
5156
maintenance = { status = "actively-developed" }
5257

cap-async-std/Cargo.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ edition = "2018"
1414

1515
[dependencies]
1616
arf-strings = { version = "0.3.0", optional = true }
17-
async-std = { version = "1.9.0", features = ["attributes"] }
17+
# Enable "unstable" for `spawn_blocking`.
18+
# Use a git dependency until https://github.com/async-rs/async-std/pull/937 is released.
19+
async-std = { git = "https://github.com/async-rs/async-std", features = ["attributes", "unstable"] }
1820
cap-primitives = { path = "../cap-primitives", version = "^0.13.11-alpha.0"}
1921
ipnet = "2.3.0"
20-
unsafe-io = { version = "0.6.0", features = ["async-std"] }
22+
unsafe-io = { version = "0.6.9", features = ["async-std"] }
2123

2224
[target.'cfg(not(windows))'.dependencies]
23-
posish = "0.6.0"
25+
posish = "0.6.1"
2426

2527
[features]
2628
default = []

cap-async-std/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,5 @@
1515
This crate provides a capability-based version of [`async-std`]. See the
1616
[toplevel README.md] for more information about capability-based security.
1717

18-
At the moment, `cap-async-std` is a very rudimentary translation of [`cap-std`] to
19-
`async-std`. It hasn't yet been optimized to make effective use of `async`.
20-
2118
[`async-std`]: https://crates.io/crates/async-std
22-
[`cap-std`]: https://github.com/bytecodealliance/cap-std/blob/main/cap-std/README.md
2319
[toplevel README.md]: https://github.com/bytecodealliance/cap-std/blob/main/README.md

0 commit comments

Comments
 (0)