-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
After experimenting a little bit with this crate, it seems apparent that deeply nested code suffers a bit. Any time an #[async_generic] function calls another #[async_generic] function, you need the same little bit of boilerplate:
#[async_generic]
fn bar() {
if _sync {
foo();
} else {
foo_async().await;
}
}It would be great if we could collapse that pattern down, like this:
#[async_generic]
fn bar() {
#[call_generic]
foo();
}There are obvious limitations to such an attribute macro, which can't recursively apply itself to all relevant functions. So I'd propose that it only applies to the outermost function in the statement. But it should still apply properly to free functions, associated functions, and methods.
Would you be positively inclined toward a PR adding this feature?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels