pub fn write(&mut self, packet: &[u8]) -> Result<(), Error<TcpStack::Error>> {
        let socket = self.socket.as_mut().ok_or(Error::NotReady)?;
        self.network_stack
            .send(socket, &packet)
            .map_err(|err| match err {
                nb::Error::WouldBlock => Error::WriteFail,
                nb::Error::Other(err) => Error::Network(err),
            })
            .and_then(|written| {
                if written != packet.len() {
                    Err(Error::WriteFail)
                } else {
                    Ok(())
                }
            })
    }
/// Write an MQTT control packet to the interface.
///
/// # Args
/// * `packet` - The packet to write.
Write an MQTT control packet to the interface.
Write an MQTT control packet to the interface .
pub fn write(&mut self, packet: &[u8]) -> Result<(), Error<TcpStack::Error>> {
        let socket = self.socket.as_mut().ok_or(Error::NotReady)?;
        self.network_stack
            .send(socket, &packet)
            .map_err(|err| match err {
                nb::Error::WouldBlock => Error::WriteFail,
                nb::Error::Other(err) => Error::Network(err),
            })
            .and_then(|written| {
                if written != packet.len() {
                    Err(Error::WriteFail)
                } else {
                    Ok(())
                }
            })
    }
pub fn write ( & mut self , packet : & [ u8 ] ) -> Result < ( ) , Error < TcpStack :: Error > > { let socket = self . socket . as_mut ( ) . ok_or ( Error :: NotReady ) ? ; self . network_stack . send ( socket , & packet ) . map_err ( | err | match err { nb :: Error :: WouldBlock => Error :: WriteFail , nb :: Error :: Other ( err ) => Error :: Network ( err ) , } ) . and_then ( | written | { if written != packet . len ( ) { Err ( Error :: WriteFail ) } else { Ok ( ( ) ) } } ) }
Write an MQTT control packet to the interface.
Write an MQTT control packet to the interface .
&mut self
packet
&[u8]
args
`packet` - The packet to write.
` packet ` - The packet to write .