Registry / async / async-fn-traits

async-fn-traits

JSON →
library0.1.1rscratesunverified

Trait synonyms for Fn-trait bounds returning futures, enabling async function traits.

# Cargo.toml [dependencies] async_fn_traits = "0.1.1"
INSTALL
IMPORT
SIG · ASYNC-FN-TRAITS
A
async-fn-traits
asyncrustv0.1.1
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.

AsyncFn
use async_fn_traits::AsyncFn;

Define and use an async function trait.

use async_fn_traits::AsyncFn; async fn example(f: impl AsyncFn(i32) -> i32) -> i32 { f.call(42).await } #[tokio::main] async fn main() { let result = example(|x| async move { x * 2 }).await; println!("Result: {}", result); }
Debug
Known issues
gotchaRequires an async runtime like tokio or async-std to execute.
fix
Add tokio or async-std as a dependency and use #[tokio::main] or similar.
affects: >=0.1.0
Upgrade
Version history
0.1.1latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
40 hits · last 30 days
node
34
Resources
async-fn-traits — cargo add async-fn-traits · libregistry