Registry / async / tokio-scoped

tokio-scoped

JSON →
library0.2.0rscratesunverified

Scoped Runtime for tokio, allowing spawning tasks with borrowed data.

# Cargo.toml [dependencies] tokio-scoped = "0.2.0"
INSTALL
IMPORT
SIG · TOKIO-SCOPED
T
tokio-scoped
asyncrustv0.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

scope
use tokio_scoped::scope;

Spawn a scoped task that borrows data from the parent scope.

use tokio_scoped::scope; #[tokio::main] async fn main() { let data = vec![1, 2, 3]; scope(|s| { s.spawn(async { println!("{:?}", data); }); }); }
Debug
Known issues
gotchaRequires tokio runtime; scoped tasks cannot outlive the scope.
fix
Ensure all spawned tasks complete before the scope ends.
affects: *
Upgrade
Version history
0.2.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
32 hits · last 30 days
node
25
OpenAI (training)
1
Resources
tokio-scoped — cargo add tokio-scoped · libregistry