blob: 86925d7b45df0550e772a608cc9fb8e67045fdff (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
|
Attribute macro that generates both a sync and an async version of a function,
gated by a Cargo feature flag.
The function is written as a regular (non-async) `fn`. The macro duplicates it
internally into two implementations:
- When the feature is **disabled**: the original `fn` is used as-is.
- When the feature is **enabled**: the function is promoted to `async fn`.
By default the feature name is `"async"`. A different name can be supplied as
an attribute argument, for example `#[func("tokio_rt")]` to gate on the feature
`"tokio_rt"` instead.
|