Async and doc tests

If you have a crate that implements some executor-agnostic async stuff and you want the doc tests to test the async functionality, what executor do you use?

I'm currently using tokio-test to get a minimal executor running for doc tests. Is there some other executor that exists for the specific purpose for being pulled in via dev-dependencies? I don't have any real complaints against tokio-test, it's just that it feels like a crate that's primarily geared toward creating AsyncRead/AsyncWrite testcases, and while I tend to default to using tokio myself, I would prefer my crate to be as executor agnostic as possible, and I don't want anyone to think that because tokio is mentioned Cargo.toml it somehow means it's only for tokio.

Pollster is an incredibly minimal async executor for Rust that lets you block a thread until a future completes.
That’s it. That’s all it does. Nothing more, nothing less. No need to pull in 50 crates to evaluate a future.
It has no dependencies, compiles quickly, and is composed of only ~100 lines of well-audited code.

3 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.