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
Working with Web Bluetooth, web-sys APIs give me js_sys::DataView objects. Conceptually, these are JavaScript's version of (typed) slices. Accessing them as slices is hard, though.
Proposed Solution
The documentation of DataView and Array should point users to the family of types around js_sys::Uint8Array, and how to turn one that was obtained into a such an array (my naïve let ble_response: js_sys::Uint8Array = characteristic.read_value().js2rs().await?.into(); did not do the trick).
Alternatives
Up until in-depth documentation review with some guessing jumps, I turned my data views into vectors going through my_vec.extend((0..ble_response.byte_length()).map(|i| ble_response.get_uint8(i))) on them. This feels extremely unergonomic and inefficient.
The text was updated successfully, but these errors were encountered:
Motivation
Working with Web Bluetooth, web-sys APIs give me
js_sys::DataView
objects. Conceptually, these are JavaScript's version of (typed) slices. Accessing them as slices is hard, though.Proposed Solution
The documentation of DataView and Array should point users to the family of types around js_sys::Uint8Array, and how to turn one that was obtained into a such an array (my naïve
let ble_response: js_sys::Uint8Array = characteristic.read_value().js2rs().await?.into();
did not do the trick).Alternatives
Up until in-depth documentation review with some guessing jumps, I turned my data views into vectors going through
my_vec.extend((0..ble_response.byte_length()).map(|i| ble_response.get_uint8(i)))
on them. This feels extremely unergonomic and inefficient.The text was updated successfully, but these errors were encountered: