Skip to main content

Crate dev_async

Crate dev_async 

Source
Expand description

§dev-async

Async-specific validation for Rust. Deadlocks, task leaks, hung futures, graceful shutdown. Part of the dev-* verification suite.

Async Rust fails in subtle ways that synchronous unit tests can’t catch: a future that never completes, a task that gets dropped without cleanup, a shutdown that hangs because one worker is stuck in a blocking call. dev-async provides primitives for catching these issues programmatically.

§Quick example

Run a future with a hard timeout. If it doesn’t finish in time, you get a Fail verdict, not a hang.

use dev_async::run_with_timeout;
use std::time::Duration;

let _check = run_with_timeout(
    "user_login",
    Duration::from_secs(2),
    async { do_login().await }
).await;

§Modules

  • deadlocktry_lock_with_timeout helpers.
  • tasksTrackedTaskGroup for leak detection.
  • shutdownShutdownProbe for graceful-shutdown verification.
  • blocking (feature block-detect) — heuristic blocking-call detection inside async tasks.

Modules§

blockingblock-detect
Heuristic blocking-call detection inside async tasks.
deadlock
Timeout-based deadlock detection helpers.
shutdown
Graceful-shutdown verification.
tasks
Task tracking for leak detection.

Structs§

BlockingAsyncProducer
Adapter that wraps an async fn returning a Report and implements dev_report::Producer by calling tokio::runtime::Handle::current().block_on(...).

Traits§

AsyncCheck
A trait for any async harness that produces a verdict via a future.
AsyncProducer
An async producer that builds a Report.

Functions§

join_all_with_timeout
Verify that all spawned tasks finish within the given timeout.
run_with_timeout
Run a future with a hard timeout. Produces a CheckResult tagged async.