pub fn publish<W5500: Registers>(
        &mut self,
        w5500: &mut W5500,
        topic: &str,
        payload: &[u8],
    ) -> Result<(), Error<W5500::Error>> {
        self.connected()?;
        let writer: TcpWriter<W5500> = w5500.tcp_writer(self.sn)?;
        send_publish(writer, topic, payload).map_err(Error::map_w5500)
    }
/// Publish data to the MQTT broker.
///
/// # Examples
///
/// ```no_run
/// # fn monotonic_secs() -> u32 { 0 }
/// # let mut w5500 = w5500_regsim::W5500::default();
/// use w5500_mqtt::{
///     ll::{
///         net::{Ipv4Addr, SocketAddrV4},
///         Sn,
///     },
///     Client, ClientId, Event, DST_PORT, SRC_PORT,
/// };
///
/// let mut client: Client = Client::new(
///     Sn::Sn2,
///     SRC_PORT,
///     SocketAddrV4::new(Ipv4Addr::new(192, 168, 5, 6), DST_PORT),
/// );
///
/// // wait for a connection or die trying
/// while !matches!(client.process(&mut w5500, monotonic_secs())?, Event::None) {}
///
/// client.publish(&mut w5500, "topic", b"data")?;
/// # Ok::<(), w5500_mqtt::Error<std::io::ErrorKind>>(())
/// ```
///
/// [`is_connected`]: Self::is_connected
Publish data to the MQTT broker.
Publish data to the MQTT broker .
pub fn publish<W5500: Registers>(
        &mut self,
        w5500: &mut W5500,
        topic: &str,
        payload: &[u8],
    ) -> Result<(), Error<W5500::Error>> {
        self.connected()?;
        let writer: TcpWriter<W5500> = w5500.tcp_writer(self.sn)?;
        send_publish(writer, topic, payload).map_err(Error::map_w5500)
    }
pub fn publish < W5500 : Registers > ( & mut self , w5500 : & mut W5500 , topic : & str , payload : & [ u8 ] , ) -> Result < ( ) , Error < W5500 :: Error > > { self . connected ( ) ? ; let writer : TcpWriter < W5500 > = w5500 . tcp_writer ( self . sn ) ? ; send_publish ( writer , topic , payload ) . map_err ( Error :: map_w5500 ) }
Publish data to the MQTT broker.
Publish data to the MQTT broker .
&mut self
w5500
&mut W5500
topic
&str
payload
&[u8]
&mut self
w5500
&mut W5500
topic
&str
payload
&[u8]
examples
None
fn monotonic_secs() -> u32 { 0 }
None
let mut w5500 = w5500_regsim::w5500::default();
use w5500_mqtt::{
ll::{
net::{Ipv4Addr, SocketAddrV4},
Sn,
},
Client, ClientId, Event, DST_PORT, SRC_PORT,
}.

let mut client: Client = Client::new(
Sn::Sn2,
SRC_PORT,
SocketAddrV4::new(Ipv4Addr::new(192, 168, 5, 6), DST_PORT),
).

wait for a connection or die trying
while !matches!(client.process(&mut w5500, monotonic_secs())?, Event::None) {}


use w5500_mqtt :: { ll :: { net :: { Ipv4Addr SocketAddrV4 } Sn } Client ClientId Event DST_PORT SRC_PORT } . let mut client : Client = Client :: new ( Sn :: Sn2 SRC_PORT SocketAddrV4 :: new ( Ipv4Addr :: new ( 192 168 5 6 ) DST_PORT ) ) . wait for a connection or die trying while !matches! ( client . process ( &mut w5500 monotonic_secs () ) ? Event :: None ) {}
ok::<(), w5500_mqtt::error<std::io::errorkind>>(())
None