Attribute Macro async_auto_traits::set [−][src]
#[set]
Set auto traits for this async fn
s return type.
Only Send
and Sync
are currently supported.
This adds an assertion that those auto traits are valid for the async fn
s body, i.e. it does
not invoke any unsafe
code and will produce a compile error when the auto traits are not
satisfied.
Example
#[async_auto_traits::set(Send + Sync)] async fn foo() {}
Planned features
Writing !Trait
should allow you to explicitly opt out of Send
or Sync
if it would
otherwise be inferred. This is for when you don't want to promise too much about the future
returned by a function to avoid future breaking changes.
Example
ⓘ
#[async_auto_traits::set(Send + !Sync)] async fn foo() {}