pub enum MdnsEvent {
QueryAnswered(QueryId, IpAddr),
QueryTimeout(QueryId),
}Expand description
Events emitted by the mDNS connection.
Poll for events using poll_event() after
calling handle_read() or
handle_timeout().
§Example
ⓘ
while let Some(event) = mdns.poll_event() {
match event {
MdnsEvent::QueryAnswered(query_id, addr) => {
println!("Query {} resolved to {}", query_id, addr);
}
MdnsEvent::QueryTimeout(query_id) => {
println!("Query {} timed out", query_id);
}
}
}Variants§
QueryAnswered(QueryId, IpAddr)
A query was successfully answered.
Contains the query ID and the resolved IP address. The query is automatically removed from the pending list.
QueryTimeout(QueryId)
A query timed out without receiving an answer.
This event is emitted when MdnsConfig::query_timeout
is set and a query exceeds its timeout duration. The query is automatically
removed from the pending list when this event is emitted.
To enable query timeouts, configure the connection with
MdnsConfig::with_query_timeout:
use rtc_mdns::MdnsConfig;
use std::time::Duration;
let config = MdnsConfig::default()
.with_query_timeout(Duration::from_secs(5));Trait Implementations§
Auto Trait Implementations§
impl Freeze for MdnsEvent
impl RefUnwindSafe for MdnsEvent
impl Send for MdnsEvent
impl Sync for MdnsEvent
impl Unpin for MdnsEvent
impl UnwindSafe for MdnsEvent
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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