-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Added WebUSB API #2345
Added WebUSB API #2345
Conversation
Looks good to me, thanks for this! Also agreed on the action taken with |
I noticed that wasm-bindgen/crates/webidl/src/idl_type.rs Lines 601 to 607 in 3c0c2b3
Or, it might be also fine to intepret any type for which What do you think? |
Ah yeah makes sense! I think that's the JS type appearing there anyway so seems reasonable to just do the same thing as |
OK, will do! |
Is there any reason to ignore generics arguments of |
Currently we don't have a great way to thread it through to the Rust definition right now and doing so would probably be a pretty large breaking change for web-sys as well. That being said it'd be better if we could do it so I'd love to have it on the docket for a future release. Was there anything else you wanted to do here before landing though? |
That makes sense. Let me squash all commits before merging. |
Thanks again! |
I added WebUSB IDL file. I took the spec from here.
In addition to adding the WebUSB spec, I added
DataView
as one of the builtin types.I guess usually generated features in
crates/web-sys/feature
are to be copied tocrates/web-sys/Cargo.toml
. SinceDataView
is actually a builtin type but not dealt so,DataView
feature is generated in Rust codes but not incrates/web-sys/feature
. Thus, one need to add it toCargo.toml
by hand. This causes future confusion and to be fixed, I think. (IMHO, this should have been done in #2316.)One drawback is that existing projects using WebBluetooth API via wasm-bindgen are broken, since
DataView
feature must be used there but it is now removed. But since WebBluetooth API is unstable feature of web-sys, it should be acceptable.