pub struct Packet {
pub address: Option<u8>,
pub command: u8,
pub data: Option<Vec<u8>>,
}
Expand description
Wake packet: address, command, and data
Fields§
§address: Option<u8>
Device address (optional) [0 - 127]
command: u8
Command [0 - 127]
data: Option<Vec<u8>>
Data load (optional)
Trait Implementations§
Source§impl Encode for Packet
Encode packet to wake format
impl Encode for Packet
Encode packet to wake format
Source§fn encode(&self) -> Result<Vec<u8>, WakeError>
fn encode(&self) -> Result<Vec<u8>, WakeError>
§Input
- Wake packet structure with address, command code and data. Address and data are optional.
§Output
Vec<u8>
- Encoded data in wake format
§Example
extern crate wake_rs;
use wake_rs::Encode;
let p = wake_rs::Packet{address: Some(0x12), command: 3, data: Some(vec!{0x00, 0xeb})};
let encoded_packet: Vec<u8> = p.encode().unwrap();
Auto Trait Implementations§
impl Freeze for Packet
impl RefUnwindSafe for Packet
impl Send for Packet
impl Sync for Packet
impl Unpin for Packet
impl UnwindSafe for Packet
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