You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dictionary types from WebIDL do not have getters. You can only mutate dictionaries, and never read them. This is weird, considering how they're often used as event types or return types.
Steps to Reproduce
Example: AudioDecoderSupport has no getters, despite being defined as a return type to indicate to the caller which formats are supported. defined here has no getters
Expected Behavior
config(&self) -> AudioDecoderConfig should be a getter
set_config(&mut self, val: &AudioDecoderConfig) should be a setter
Actual Behavior
config(&mut self, val: &AudioDecoderConfig) is the only function available regarding the underlying config field, and it is a setter.
Additional Context
This is the generating code. I've dumped several hours into modifying it to generate a setter, but I've failed so far. My main issue is how do you generically convert the a JsValue from js_sys::Reflect::get into the appropriate return type? There are lots of special cases that work but it's unclear how to do this generically. E.g., how do I turn a JsValue into an Option<i32>?
Very stumped here, but willing to do work to make a PR. Please comment with pointers and I'll be on it.
The text was updated successfully, but these errors were encountered:
My main issue is how do you generically convert the a JsValue from js_sys::Reflect::get into the appropriate return type? There are lots of special cases that work but it's unclear how to do this generically. E.g., how do I turn a JsValue into an Option<i32>?
Probably through JsValue::as_f64(), but this shouldn't be a concern anymore since #3898.
Describe the Bug
dictionary
types from WebIDL do not have getters. You can only mutate dictionaries, and never read them. This is weird, considering how they're often used as event types or return types.Steps to Reproduce
Example:
AudioDecoderSupport
has no getters, despite being defined as a return type to indicate to the caller which formats are supported. defined here has no gettersExpected Behavior
config(&self) -> AudioDecoderConfig
should be a getterset_config(&mut self, val: &AudioDecoderConfig)
should be a setterActual Behavior
config(&mut self, val: &AudioDecoderConfig)
is the only function available regarding the underlyingconfig
field, and it is a setter.Additional Context
This is the generating code. I've dumped several hours into modifying it to generate a setter, but I've failed so far. My main issue is how do you generically convert the a
JsValue
fromjs_sys::Reflect::get
into the appropriate return type? There are lots of special cases that work but it's unclear how to do this generically. E.g., how do I turn aJsValue
into anOption<i32>
?Very stumped here, but willing to do work to make a PR. Please comment with pointers and I'll be on it.
The text was updated successfully, but these errors were encountered: