Skip to content

Add .into() to the generated code for async fns #3919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 28, 2024

Conversation

MOZGIII
Copy link
Contributor

@MOZGIII MOZGIII commented Apr 10, 2024

Without this I am getting an error for declarations like these:

    #[wasm_bindgen(method, getter)]
    pub async fn closed(this: &WebTransport) -> WebTransportCloseInfo;
    #[wasm_bindgen(method, getter, catch)]
    pub async fn closed(this: &WebTransport) -> Result<WebTransportCloseInfo, JsValue>;

I have tried to also create a test for this to catch regressions, but was unable to figure out where to put it.

Test

use wasm_bindgen::prelude::*;

#[wasm_bindgen]
extern "C" {
    #[wasm_bindgen]
    #[derive(Debug, Clone)]
    pub type WebTransportCloseInfo;
}

#[wasm_bindgen]
extern "C" {
    #[wasm_bindgen]
    #[derive(Debug, Clone)]
    pub type WebTransport;

    #[wasm_bindgen(method, getter, catch)]
    pub async fn closed(this: &WebTransport) -> Result<WebTransportCloseInfo, JsValue>;
}

@MOZGIII MOZGIII changed the title Add into to the generated code for async fns Add .into() to the generated code for async fns Apr 10, 2024
Copy link
Collaborator

@daxpedda daxpedda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised this hasn't come up until now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants