async_coap/send_desc/
multicast.rs1use super::send_desc_passthru_options;
17use super::*;
18
19#[derive(Debug)]
26pub struct Multicast<SD>(pub(crate) SD);
27
28impl<SD> SendDescMulticast for Multicast<SD> {}
29impl<SD: Default> Default for Multicast<SD> {
30 #[inline]
31 fn default() -> Self {
32 Self(Default::default())
33 }
34}
35
36impl<SD, IC> SendDesc<IC, ()> for Multicast<SD>
37where
38 SD: SendDesc<IC, ()> + Send,
39 IC: InboundContext,
40{
41 send_desc_passthru_options!(0);
42 send_desc_passthru_supports_option!(0);
43
44 fn delay_to_retransmit(&self, retransmits_sent: u32) -> Option<Duration> {
45 self.0.delay_to_retransmit(retransmits_sent)
46 }
47 fn delay_to_restart(&self) -> Option<Duration> {
48 self.0.delay_to_restart()
49 }
50 fn max_rtt(&self) -> Duration {
51 Duration::from_secs(8)
52 }
53 fn transmit_wait_duration(&self) -> Duration {
54 Duration::from_secs(8)
55 }
56
57 fn write_payload(
58 &self,
59 msg: &mut dyn MessageWrite,
60 socket_addr: &IC::SocketAddr,
61 ) -> Result<(), Error> {
62 self.0.write_payload(msg, socket_addr)?;
63 msg.set_msg_type(MsgType::Non);
64 Ok(())
65 }
66
67 fn handler(&mut self, context: Result<&IC, Error>) -> Result<ResponseStatus<()>, Error> {
68 context?;
69 Ok(ResponseStatus::Continue)
70 }
71}