pub enum ServiceEvent {
New(ServiceInfo),
Updated(ServiceInfo),
Removed(ServiceInfo),
VerificationFailed(ServiceInfo),
DiscoveryStarted {
service_types: Vec<ServiceType>,
protocols: Vec<ProtocolType>,
},
DiscoveryCompleted {
services_found: usize,
duration: Duration,
},
DiscoveryFailed {
error: String,
service_types: Vec<ServiceType>,
},
}Expand description
Events that can occur during service discovery
Variants§
New(ServiceInfo)
A new service was discovered
Updated(ServiceInfo)
An existing service was updated
Removed(ServiceInfo)
A service was removed or expired
VerificationFailed(ServiceInfo)
A service failed verification
DiscoveryStarted
Discovery process started
Fields
§
service_types: Vec<ServiceType>Service types being searched for
§
protocols: Vec<ProtocolType>Protocols being used
DiscoveryCompleted
Discovery process completed
DiscoveryFailed
Discovery process failed
Implementations§
Source§impl ServiceEvent
impl ServiceEvent
Sourcepub fn new(service: ServiceInfo) -> Self
pub fn new(service: ServiceInfo) -> Self
Create a new service event
Sourcepub fn updated(service: ServiceInfo) -> Self
pub fn updated(service: ServiceInfo) -> Self
Create an updated service event
Sourcepub fn removed(service: ServiceInfo) -> Self
pub fn removed(service: ServiceInfo) -> Self
Create a removed service event
Sourcepub fn verification_failed(service: ServiceInfo) -> Self
pub fn verification_failed(service: ServiceInfo) -> Self
Create a verification failed event
Sourcepub fn discovery_started(
service_types: Vec<ServiceType>,
protocols: Vec<ProtocolType>,
) -> Self
pub fn discovery_started( service_types: Vec<ServiceType>, protocols: Vec<ProtocolType>, ) -> Self
Create a discovery started event
Sourcepub fn discovery_completed(services_found: usize, duration: Duration) -> Self
pub fn discovery_completed(services_found: usize, duration: Duration) -> Self
Create a discovery completed event
Sourcepub fn discovery_failed<S: Into<String>>(
error: S,
service_types: Vec<ServiceType>,
) -> Self
pub fn discovery_failed<S: Into<String>>( error: S, service_types: Vec<ServiceType>, ) -> Self
Create a discovery failed event
Sourcepub fn service(&self) -> Option<&ServiceInfo>
pub fn service(&self) -> Option<&ServiceInfo>
Get the service info if this event contains one
Sourcepub fn is_positive(&self) -> bool
pub fn is_positive(&self) -> bool
Check if this is a positive event (new or updated service)
Sourcepub fn is_negative(&self) -> bool
pub fn is_negative(&self) -> bool
Check if this is a negative event (removed service or failure)
Trait Implementations§
Source§impl Clone for ServiceEvent
impl Clone for ServiceEvent
Source§fn clone(&self) -> ServiceEvent
fn clone(&self) -> ServiceEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ServiceEvent
impl Debug for ServiceEvent
Source§impl<'de> Deserialize<'de> for ServiceEvent
impl<'de> Deserialize<'de> for ServiceEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ServiceEvent
impl Display for ServiceEvent
Source§impl PartialEq for ServiceEvent
impl PartialEq for ServiceEvent
Source§impl Serialize for ServiceEvent
impl Serialize for ServiceEvent
impl Eq for ServiceEvent
impl StructuralPartialEq for ServiceEvent
Auto Trait Implementations§
impl Freeze for ServiceEvent
impl RefUnwindSafe for ServiceEvent
impl Send for ServiceEvent
impl Sync for ServiceEvent
impl Unpin for ServiceEvent
impl UnwindSafe for ServiceEvent
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