Struct hid_io_protocol::buffer::Buffer [−][src]
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
impl<Q: ArrayLength<Vec<u8, N>>, N: ArrayLength<u8>> Buffer<Q, N>
[src]
pub fn new() -> Buffer<Q, N>
[src]
pub fn peek(&self) -> Option<&Vec<u8, N>>
[src]
Checks the first item array Returns None if there are no items in the queue Does not dequeue
pub fn dequeue(&mut self) -> Option<Vec<u8, N>>
[src]
Dequeues and returns the first item array Returns None if there are no items in the queue
pub fn enqueue(&mut self, data: Vec<u8, N>) -> Result<(), Vec<u8, N>>
[src]
Enqueues Returns the array if there’s not enough space
pub fn clear(&mut self)
[src]
Clears the buffer Needed for some error conditions
pub fn capacity(&self) -> u8
[src]
Capacity of buffer
pub fn len(&self) -> u8
[src]
Number of elements stored in the buffer
pub fn is_empty(&self) -> bool
[src]
Buffer empty
pub fn is_full(&self) -> bool
[src]
Buffer full
Trait Implementations
impl<Q, N> Default for Buffer<Q, N> where
Q: ArrayLength<Vec<u8, N>>,
N: ArrayLength<u8>,
[src]
Q: ArrayLength<Vec<u8, N>>,
N: ArrayLength<u8>,
Auto Trait Implementations
impl<Q, N> !RefUnwindSafe for Buffer<Q, N>
impl<Q, N> Send for Buffer<Q, N>
impl<Q, N> !Sync for Buffer<Q, N>
impl<Q, N> Unpin for Buffer<Q, N> where
<Q as ArrayLength<Vec<u8, N>>>::ArrayType: Unpin,
<Q as ArrayLength<Vec<u8, N>>>::ArrayType: Unpin,
impl<Q, N> UnwindSafe for Buffer<Q, N> where
<Q as ArrayLength<Vec<u8, N>>>::ArrayType: UnwindSafe,
<Q as ArrayLength<Vec<u8, N>>>::ArrayType: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,