Skip to content

[Bug] .into_async_callback() fails for systems with only the In parameter #159

@mxgrey

Description

@mxgrey

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions