pub fn padded_initialization(
        channel: u32,
        command: Command,
        payload: &[u8],
        packet_length: u16,
    ) -> Result<Self, Error> {
        let payload_length: u16 = payload.len().try_into()?;
        if packet_length < INIT_HEADER_LENGTH + payload_length {
            return Err(format_err!("Padded initialization packet length shorter than content"));
        }
        Self::initialization(
            channel,
            command,
            payload_length,
            pad(payload, packet_length - INIT_HEADER_LENGTH - payload_length)?,
        )
    }
/// Creates a new initialization packet using data padded out to the supplied packet length.
/// This will require a copy, hence the payload is supplied by reference.
Creates a new initialization packet using data padded out to the supplied packet length.
This will require a copy, hence the payload is supplied by reference.
Creates a new initialization packet using data padded out to the supplied packet length . This will require a copy hence the payload is supplied by reference .
pub fn padded_initialization(
        channel: u32,
        command: Command,
        payload: &[u8],
        packet_length: u16,
    ) -> Result<Self, Error> {
        let payload_length: u16 = payload.len().try_into()?;
        if packet_length < INIT_HEADER_LENGTH + payload_length {
            return Err(format_err!("Padded initialization packet length shorter than content"));
        }
        Self::initialization(
            channel,
            command,
            payload_length,
            pad(payload, packet_length - INIT_HEADER_LENGTH - payload_length)?,
        )
    }
pub fn padded_initialization ( channel : u32 , command : Command , payload : & [ u8 ] , packet_length : u16 , ) -> Result < Self , Error > { let payload_length : u16 = payload . len ( ) . try_into ( ) ? ; if packet_length < INIT_HEADER_LENGTH + payload_length { return Err ( format_err ! ( " " ) ) ; } Self :: initialization ( channel , command , payload_length , pad ( payload , packet_length - INIT_HEADER_LENGTH - payload_length ) ? , ) }
Creates a new initialization packet using data padded out to the supplied packet length.
Creates a new initialization packet using data padded out to the supplied packet length .
channel
u32
command
Command
payload
&[u8]
packet_length
u16