pub struct SharedMulticastUdpSocket { /* private fields */ }Expand description
A multicast socket with shared .recv_from(). It’ll call all subscribed handlers. You MUST spawn task_listen_forever().
Implementations§
pub fn new(sock: MulticastUdpSocket) -> Result<Arc<Self>>
pub fn add_handler( self: &Arc<Self>, handler: Box<dyn Fn(&[u8], SocketAddr) + Send + Sync + 'static>, )
pub async fn send_to(&self, buf: &[u8], addr: SocketAddr) -> Result<usize>
pub async fn task_listen_forever(self: Arc<Self>) -> Result<()>
pub async fn try_send_mcast_everywhere( &self, get_payload: &impl Fn(&MulticastOpts) -> Option<String>, )
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more