Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 7b215bc

Browse files
authored
Merge pull request #233 from alexcrichton/accessor-apis
Add `&Accessor<T, D>` to all future/stream APIs
2 parents 3029fef + f65c743 commit 7b215bc

File tree

17 files changed

+581
-525
lines changed

17 files changed

+581
-525
lines changed

crates/misc/component-async-tests/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ workspace = true
1212

1313
[dependencies]
1414
anyhow = { workspace = true }
15-
futures = { workspace = true }
15+
futures = { workspace = true, features = ['async-await'] }
1616
env_logger = { workspace = true }
1717
tempfile = { workspace = true }
1818
tokio = { workspace = true, features = [

crates/misc/component-async-tests/src/resource_stream.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,9 @@ impl bindings::local::local::resource_stream::HostConcurrent for Ctx {
5151
async fn run(self, accessor: &Accessor<T, Ctx>) -> Result<()> {
5252
let mut tx = Some(self.tx);
5353
for _ in 0..self.count {
54-
tx = accessor
55-
.with(|mut view| {
56-
let item = view.get().table().push(ResourceStreamX)?;
57-
Ok::<_, anyhow::Error>(tx.take().unwrap().write_all(Some(item)))
58-
})?
59-
.await
60-
.0;
54+
let item =
55+
accessor.with(|mut view| view.get().table().push(ResourceStreamX))?;
56+
tx = tx.take().unwrap().write_all(accessor, Some(item)).await.0;
6157
}
6258
Ok(())
6359
}

0 commit comments

Comments
 (0)