xwt icon indicating copy to clipboard operation
xwt copied to clipboard

Hand-crafted WebTransport Web API bindings

Open MOZGIII opened this issue 2 months ago • 0 comments

Blocked by: https://github.com/rustwasm/wasm-bindgen/pull/3919


This is a replacement for the web-sys crate (and https://github.com/MOZGIII/xwt/pull/117), hard-written instead of being code-generated to overcome the current shortcomings of the wasm_bindgen_webidl codegen and its choices. See more on that: https://github.com/rustwasm/wasm-bindgen/issues/3921

Currently requires a custom wasm_bindgen with https://github.com/rustwasm/wasm-bindgen/pull/3919 applied.


The rationale for the hard-written bindings are greater for the development experience, since you get the code that doesn't have JsValues as return types - but a much saner types without a need for manual conversion (this is actually something that we had bugs with before), but also performance gains, since we can add final clause to the wasm_bindgen macro invocation for more efficient bindings at the hot I/O paths.

The hand crafted bindings turned out to be much more comprehensive and useful than the generated ones - because the generated bindings just lack some huge parts of the API surface, and other part of the API are simply generated wrong and/or unusable due to invalid assumptions of the code generator. Needless to say, the generated code is just not ergonomic without a real reason for it - must be a shortcoming of the generator, and most likely fixable - see https://github.com/rustwasm/wasm-bindgen/issues/3921.

MOZGIII avatar Apr 11 '24 15:04 MOZGIII