Struct lifx_core::RawMessage [−][src]
pub struct RawMessage {
pub frame: Frame,
pub frame_addr: FrameAddress,
pub protocol_header: ProtocolHeader,
pub payload: Vec<u8>,
}The raw message structure
Contains a low-level protocol info. This is what is sent and received via UDP packets.
To parse the payload, use Message::from_raw.
Fields
frame: Frame
frame_addr: FrameAddress
protocol_header: ProtocolHeader
payload: Vec<u8>
Methods
impl RawMessage[src]
impl RawMessagepub fn build(options: &BuildOptions, typ: Message) -> Result<RawMessage, Error>[src]
pub fn build(options: &BuildOptions, typ: Message) -> Result<RawMessage, Error>Build a RawMessage (which is suitable for sending on the network) from a given Message type.
If BuildOptions::target is None, then the message is addressed to all devices. Else it should be a bulb UID (MAC address)
pub fn packed_size(&self) -> usize[src]
pub fn packed_size(&self) -> usizeThe total size (in bytes) of the packed version of this message.
pub fn validate(&self)[src]
pub fn validate(&self)Validates that this object was constructed correctly. Panics if not.
pub fn pack(&self) -> Result<Vec<u8>, Error>[src]
pub fn pack(&self) -> Result<Vec<u8>, Error>Packs this RawMessage into some bytes that can be send over the network.
The length of the returned data will be RawMessage::packed_size in size.
pub fn unpack(v: &[u8]) -> Result<RawMessage, Error>[src]
pub fn unpack(v: &[u8]) -> Result<RawMessage, Error>Given some bytes (generally read from a network socket), unpack the data into a
RawMessage structure.
Trait Implementations
impl Debug for RawMessage[src]
impl Debug for RawMessagefn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Clone for RawMessage[src]
impl Clone for RawMessagefn clone(&self) -> RawMessage[src]
fn clone(&self) -> RawMessageReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl PartialEq for RawMessage[src]
impl PartialEq for RawMessagefn eq(&self, other: &RawMessage) -> bool[src]
fn eq(&self, other: &RawMessage) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &RawMessage) -> bool[src]
fn ne(&self, other: &RawMessage) -> boolThis method tests for !=.
Auto Trait Implementations
impl Send for RawMessage
impl Send for RawMessageimpl Sync for RawMessage
impl Sync for RawMessage