pub fn poll_with_response_handler<ST>(
stack: &mut ST,
socket: &mut ST::UdpSocket,
handler: &mut impl Handler,
response_handler: impl for<'a> FnOnce(u16, &'a [u8], &'a Message<'a>) -> bool
) -> Result<(), ST::Error>where
ST: UdpFullStack + ?Sized,
Expand description
Like poll, but allowing a callback for response messages.
The response_handler
will be called on every received CoAP response (including empty ACKs),
with message ID, token and the message. It should return true if the response was expected, and
false if not; this influences whether a CON will be responded to with an ACK or an RST.
Users should not rely on the message argument to the handler to be precisely the indicated type; it may change to any implementation of coap_message::ReadableMessage.