pub fn new(command: u16, payload: Vec<u8>) -> (Self, Receiver<Vec<u8>>) {
        // This size includes the two bytes for command and two bytes for
        // payload length.
        let bytes_len = 4 + payload.len();
        if bytes_len > ARDUINO_BUFFER_SIZE {
            panic!(
                "Overall message size of {} bytes is larger than Arduino buffer.",
                bytes_len
            );
        }

        let (sender, receiver) = mpsc::channel();
        let message = Message {
            command,
            payload,
            sender,
        };
        (message, receiver)
    }
/// Construct a new message from command number and command payload. The
/// method returns a tuple with the newly constructed message and a
/// `Receiver` via which a command response will be delivered.
///
/// Command response is send via the channel to the `Receiver` once it is
/// obtained from the Arduino. No other data is ever send via the channel.
///
/// # Arguments
///
/// * `command` - identifier of the command to be send.
///
/// * `payload` - command payload. Note that the total message size cannot
///    be larger than `ARDUINO_BUFFER_SIZE`. Note that message size
///    includes 2 bytes for command number and 2 bytes payload length.
///
/// # Panics
///
/// The method panics if the `payload` wouldn't fit the Arduino buffer.
///
/// # Examples
///
/// ```
/// use irro::arduino::binary::Message;
/// // Message which turns on LED 0.
/// let (message, receiver) = Message::new(0, vec![128]);
/// ```
Construct a new message from command number and command payload. The
method returns a tuple with the newly constructed message and a
`Receiver` via which a command response will be delivered.

Command response is send via the channel to the `Receiver` once it is
obtained from the Arduino. No other data is ever send via the channel.
Construct a new message from command number and command payload . The method returns a tuple with the newly constructed message and a ` Receiver ` via which a command response will be delivered . Command response is send via the channel to the ` Receiver ` once it is obtained from the Arduino . No other data is ever send via the channel .
pub fn new(command: u16, payload: Vec<u8>) -> (Self, Receiver<Vec<u8>>) {
        // This size includes the two bytes for command and two bytes for
        // payload length.
        let bytes_len = 4 + payload.len();
        if bytes_len > ARDUINO_BUFFER_SIZE {
            panic!(
                "Overall message size of {} bytes is larger than Arduino buffer.",
                bytes_len
            );
        }
        let (sender, receiver) = mpsc::channel();
        let message = Message {
            command,
            payload,
            sender,
        };
        (message, receiver)
    }
pub fn new ( command : u16 , payload : Vec < u8 > ) -> ( Self , Receiver < Vec < u8 > > ) { // This size includes the two bytes for command and two bytes for // payload length. let bytes_len = 4 + payload . len ( ) ; if bytes_len > ARDUINO_BUFFER_SIZE { panic ! ( " " bytes_len ) ; } let ( sender , receiver ) = mpsc :: channel ( ) ; let message = Message { command , payload , sender , } ; ( message , receiver ) }
Construct a new message from command number and command payload.
Construct a new message from command number and command payload .
command
u16
payload
Vec<u8>
command
u16
payload
Vec<u8>
panics
The method panics if the `payload` wouldn't fit the Arduino buffer.
The method panics if the ` payload ` wouldn ' t fit the Arduino buffer .
examples
```
use irro::arduino::binary::Message;
Message which turns on LED 0.
` ` ` use irro :: arduino :: binary :: Message ; Message which turns on LED 0 .