Struct hid_io_protocol::buffer::Buffer[][src]

pub struct Buffer<Q: ArrayLength<Vec<u8, N>>, N: ArrayLength<u8>> { /* fields omitted */ }

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

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]

Constructor for Buffer

Remarks

Initialize as blank This buffer has a limit of 65535 elements

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]

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

impl<Q, N> UnwindSafe for Buffer<Q, N> where
    <Q as ArrayLength<Vec<u8, N>>>::ArrayType: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.