Skip to content
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

[WIP] wasm-bindgen support #167

Closed
wants to merge 1 commit into from
Closed

Conversation

Tarnadas
Copy link

@Tarnadas Tarnadas commented Mar 13, 2019

Hey!

I am trying to add wasm-bindgen support and stumbled across several problems. This PR is still very wip.

  • I don't know how to define a feature for a sub-crate for conditional compilation. See commented out cfg! code
  • wasm-bindgen does not support pub vectors within structs, so I just removed the pub for them (see Vectors not working in structs rustwasm/wasm-bindgen#439)
  • probably the biggest problem so far: oneof gets converted to enums holding data, which isn't supported by wasm-bindgen and it will probably take a lot of effort to support them within wasm-bindgen (see Support for C-Style Enums rustwasm/wasm-bindgen#31). It might be easier to change code generation of proto files for oneofs instead

@Tarnadas Tarnadas changed the title wasm-bindgen support [WIP] wasm-bindgen support Mar 13, 2019
@danburkert
Copy link
Collaborator

Hi sorry for slow feedback - is this still a going concern? I would ideally like prost to be compatible with wasm, but the concerns about enums with data seems like a pretty hard blocker. For context I have no wasm experience, so I don't know if the state of the world has changed in the last 18 months.

@Tarnadas
Copy link
Author

Hey,
it doesn't look like anything has changed regarding enums, so a workaround for a WebAssembly version would be required.

I was rather new to Rust when I started this PR and I think I might get this working somehow.
As a reference, I will see how other Protobuf libraries in JavaScript do their code generation and try to make something similar for the WebAssembly version.

@ImJeremyHe
Copy link

It is better to do this work after wasm-bindgen supporting enums: rustwasm/wasm-bindgen#2631

@caspermeijn
Copy link
Collaborator

@Tarnadas Are you still working on this, or can it be closed?

@Tarnadas
Copy link
Author

Tarnadas commented Jun 7, 2024

Hey, it can be closed

@Tarnadas Tarnadas closed this Jun 7, 2024
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.

4 participants