mirror of
https://github.com/G2-Games/cross-usb.git
synced 2025-04-18 12:52:53 -05:00
Fixed compilation error on wasm by handling errors
This commit is contained in:
parent
9505ef0204
commit
71fafc0b0d
2 changed files with 8 additions and 4 deletions
|
@ -3,5 +3,5 @@ rustflags = ["--cfg=web_sys_unstable_apis"]
|
|||
|
||||
[build]
|
||||
#just comment in the "current" target
|
||||
target = "x86_64-unknown-linux-gnu"
|
||||
#target = "wasm32-unknown-unknown"
|
||||
#target = "x86_64-unknown-linux-gnu"
|
||||
target = "wasm32-unknown-unknown"
|
||||
|
|
|
@ -410,7 +410,9 @@ impl<'a> UsbInterface<'a> for Interface {
|
|||
let result: UsbOutTransferResult = match JsFuture::from(Promise::resolve(
|
||||
&self
|
||||
.device
|
||||
.control_transfer_out_with_buffer_source(¶ms, array_obj),
|
||||
.control_transfer_out_with_buffer_source(¶ms, array_obj)
|
||||
.map_err(|j| Error::CommunicationError(j.as_string().unwrap_or_default()))?
|
||||
.into(),
|
||||
))
|
||||
.await
|
||||
{
|
||||
|
@ -448,7 +450,9 @@ impl<'a> UsbInterface<'a> for Interface {
|
|||
let promise = Promise::resolve(
|
||||
&self
|
||||
.device
|
||||
.transfer_out_with_buffer_source(endpoint, array_obj),
|
||||
.transfer_out_with_buffer_source(endpoint, array_obj)
|
||||
.map_err(|j| Error::CommunicationError(j.as_string().unwrap_or_default()))?
|
||||
.into(),
|
||||
);
|
||||
|
||||
let result = JsFuture::from(promise).await;
|
||||
|
|
Loading…
Reference in a new issue