[−][src]Struct hid_io::protocol::hidio::HIDIOPacketBuffer
HID-IO Packet Buffer Struct
Remarks
Used to store HID-IO data chunks. Will be chunked into individual packets on transmission.
Fields
ptype: HIDIOPacketType
Type of packet (Continued is automatically set if needed)
id: u32
Packet Id
max_len: u32
Packet length for serialization (in bytes)
data: Vec<u8>
Payload data, chunking is done automatically by serializer
done: bool
Set False if buffer is not complete, True if it is
Methods
impl HIDIOPacketBuffer
[src]
pub fn new() -> HIDIOPacketBuffer
[src]
pub fn append_payload(&mut self, new_data: &mut Vec<u8>) -> bool
[src]
Append payload data
Arguments
new_data
- Vector of bytes
Remarks
Appends payload to HIDIOPacketBuffer.
pub fn decode_packet(
&mut self,
packet_data: &mut Vec<u8>
) -> Result<u32, HIDIOParseError>
[src]
&mut self,
packet_data: &mut Vec<u8>
) -> Result<u32, HIDIOParseError>
Append packet stream Returns the number of bytes used.
Arguments
packet_data
- Vector of bytes of packet data
Remarks
Does packet decoding on the fly. Will set done parameter if this is the last packet.
pub fn serialize_buffer(&mut self) -> Result<Vec<u8>, HIDIOParseError>
[src]
Serialize HIDIOPacketBuffer
Remarks
Provides a raw data vector to the serialized data. Removes some of the header that Serialize from serde prepends.
Trait Implementations
impl Clone for HIDIOPacketBuffer
[src]
fn clone(&self) -> HIDIOPacketBuffer
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Default for HIDIOPacketBuffer
[src]
impl PartialEq<HIDIOPacketBuffer> for HIDIOPacketBuffer
[src]
fn eq(&self, other: &HIDIOPacketBuffer) -> bool
[src]
fn ne(&self, other: &HIDIOPacketBuffer) -> bool
[src]
impl Display for HIDIOPacketBuffer
[src]
impl Debug for HIDIOPacketBuffer
[src]
impl Serialize for HIDIOPacketBuffer
[src]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
[src]
S: Serializer,
Serializer for HIDIOPacketBuffer
Remarks
Determine cont, width, upper_len and len fields According to this C-Struct:
struct HIDIO_Packet {
HIDIO_Packet_Type type:3;
uint8_t cont:1; // 0 - Only packet, 1 continued packet following
uint8_t id_width:1; // 0 - 16bits, 1 - 32bits
uint8_t reserved:1; // Reserved
uint8_t upper_len:2; // Upper 2 bits of length field (generally unused)
uint8_t len; // Lower 8 bits of length field
uint8_t data[0]; // Start of data payload (may start with Id)
};
Auto Trait Implementations
impl Send for HIDIOPacketBuffer
impl Sync for HIDIOPacketBuffer
impl Unpin for HIDIOPacketBuffer
impl UnwindSafe for HIDIOPacketBuffer
impl RefUnwindSafe for HIDIOPacketBuffer
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,