-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed
Description
The following example results in a compilation error:
async fn page_title_callback(In(url): In<String>) -> Option<String> {
let response = trpl::get(&url).await;
let response_text = response.text().await;
trpl::Html::parse(&response_text)
.select_first("title")
.map(|title| title.inner_html())
}
let title_callback = page_title_callback.into_async_callback();even though that same function can be made into an async service. It can even be made into a callback if AsyncCallbackInput is used instead of In.
It's not clear to me where the incompatibility is coming from, but I would guess it's related to the additional Task generic in the IntoAsyncCallback trait.
This isn't a crucial error because this type of function can just be made into a map instead. There's no reason for this to be a Bevy system. Adding even one more system parameter of any kind to the function allows .into_async_callback() to work.
Still it's an odd limitation, and worth looking into if anyone has spare time and interest.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed