Struct hid_io_protocol::buffer::Buffer
source · pub struct Buffer<const Q: usize, const N: usize> { /* private fields */ }
Expand description
HID-IO byte buffer This buffer is a queue of vecs with static allocation Each vec is fixed sized as HID-IO interface has a fixed transport payload (even if the actual size of the message is less). This buffer has no notion of packet size so it must store the full transport payload. In the minimal scenario a queue size of 1 is used.
Common HID-IO Vec capacities
- 7 bytes (USB 2.0 LS /w HID ID byte)
- 8 bytes (USB 2.0 LS)
- 63 bytes (USB 2.0 FS /w HID ID byte)
- 64 bytes (USB 2.0 FS)
- 1023 bytes (USB 2.0 HS /w HID ID byte)
- 1024 bytes (USB 2.0 HS)
The maximum queue size is 255
Implementations§
source§impl<const Q: usize, const N: usize> Buffer<Q, N>
impl<const Q: usize, const N: usize> Buffer<Q, N>
sourcepub fn peek(&self) -> Option<&Vec<u8, N>>
pub fn peek(&self) -> Option<&Vec<u8, N>>
Checks the first item array Returns None if there are no items in the queue Does not dequeue
sourcepub fn dequeue(&mut self) -> Option<Vec<u8, N>>
pub fn dequeue(&mut self) -> Option<Vec<u8, N>>
Dequeues and returns the first item array Returns None if there are no items in the queue
Trait Implementations§
Auto Trait Implementations§
impl<const Q: usize, const N: usize> !RefUnwindSafe for Buffer<Q, N>
impl<const Q: usize, const N: usize> Send for Buffer<Q, N>
impl<const Q: usize, const N: usize> !Sync for Buffer<Q, N>
impl<const Q: usize, const N: usize> Unpin for Buffer<Q, N>
impl<const Q: usize, const N: usize> UnwindSafe for Buffer<Q, N>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more