Expand description
Utilities for writing completion-based asynchronous code.
A completion future is a future that must be run to completion, unlike regular futures which
can be dropped and stopped at any time without the future’s knowledge. This allows for more
flexibility for the implementer of the future and allows APIs like io_uring
and IOCP to be
wrapped in a zero-cost way.
This is based off this RFC by Matthias247.
§Features
std
: Enables features that require the standard library, on by default.alloc
: Enables features that require allocation, on by default.macro
: Enables thecompletion
,completion_async
,completion_async_move
andcompletion_stream
macros, on by default.
Re-exports§
pub use completion_core::CompletionFuture;
pub use completion_core::CompletionStream;
pub use self::future::BoxCompletionFuture;
pub use self::future::LocalBoxCompletionFuture;
pub use self::future::CompletionFutureExt;
pub use self::future::FutureExt;
pub use self::stream::BoxCompletionStream;
pub use self::stream::LocalBoxCompletionStream;
pub use self::stream::CompletionStreamExt;
pub use self::stream::StreamExt;
Modules§
- future
- Utilities for the
CompletionFuture
trait. - io
std
- Utilities for programming with asynchronous I/O.
- stream
- Utilities for the
CompletionStream
trait.
Macros§
- completion_
async macro
andstd
- A bang macro to generate completion
async
blocks. - completion_
async_ move macro
andstd
- A bang macro to generate completion
async move
blocks. - completion_
stream macro
andstd
- A bang macro to generate completion async streams.
Structs§
- Adapter
- Helper type to implement
CompletionFuture
orCompletionStream
for a type that only implementsFuture
orStream
. - Assert
Completes - Unsafely assert that the inner future or stream will complete.
- Must
Complete - Make sure that a future or stream will complete, created by
CompletionFutureExt::must_complete
andCompletionStreamExt::must_complete
.
Attribute Macros§
- completion
macro
andstd
- An attribute macro to generate completion
async fn
s. These async functions evaluate to aCompletionFuture
, and you can.await
otherCompletionFuture
s inside of them.