You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on an autogenerated EventHandler trait with many async fn on_some_event() methods. There is also one async fn fallback() method for which all default implementations of on_some_event call, giving:
#[async_trait::async_trait]traitEventHandler{asyncfnfallback(self,args:SomeType) -> U;// This 30 times or so for default implementationsasyncfnon_some_event(self,args:SomeType) -> U{self.fallback(args).await}}
This leads to double-boxing the fallback future, which is likely executing more often than not if the library users don't handle all events.
Would it be possible to flag an async method as "transparent" perhaps? Strip the .await and return the result directly.
I'm working on an autogenerated
EventHandler
trait with manyasync fn on_some_event()
methods. There is also oneasync fn fallback()
method for which all default implementations ofon_some_event
call, giving:This leads to double-boxing the fallback future, which is likely executing more often than not if the library users don't handle all events.
Would it be possible to flag an async method as "
transparent
" perhaps? Strip the.await
and return the result directly.However, if the
async_trait
codegen is stable enough, I could also just desugar it manually for default implementations.The text was updated successfully, but these errors were encountered: