Async trait methods for no_std
Features like async-trait, avoid using Box and dyn. You can use async keywork in trait without alloc.
Thanks to crate async-trait, some code from these.
WARNING: This crate use some unstable even incomplete feature. You will get some warning from compiler.
If you want to use crate, please add #![feature(type_alias_impl_trait)] and #![feature(generic_associated_types)]
to you crate's root file.
This crate support async in trait through #[async_trait] and sup
Support syntax
asyncin trait.#[async_trait].impl traitas return in trait.#[ritit].
Features Status
-
Self-
Selfby reference. -
Selfby value. -
Selfby mut reference. - no
Self. - any type of
Self. (need test) -
Selfby mut value. (It seems unuse)
-
- Any number of arguments, any return value.
- Arguments.
- As value.
- As reference without lifetime.
- Return value expect reference (return reference at
Lifetime return). (need test)
- Arguments.
- Lifetime parameters. (need test)
- Lifetime arguments.
- Lifetime return.
- Associated types support. (need test)
- Having async and non-async functions in the same trait.
- support default
async fnimplementations in trait. - Generic type parameters.
- Generic arguments.
- Generic return. (need implement)
-
impl traitin arguments. (need implement)
Usage
Please enable feature type_alias_impl_trait and generic_associated_types;
async_trait
use async_trait;
async
;
ritit
use ritit;
;