#[non_exhaustive]pub enum ServiceState {
Init,
Probing(u8),
Announcing(u8),
Established,
Conflicting,
}Expand description
Lifecycle state of a registered service.
Transitions:
Init → Probing(0..3) → Announcing(0..2) → Established
Probing(_) -[conflict]→ Conflicting (caller decides next step)
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Init
Just registered; waiting on initial 0–250 ms randomized delay.
Probing(u8)
Probing: probes sent so far (0, 1, or 2 — third probe ends probing).
Announcing(u8)
Announcing: announcements sent so far (0 or 1).
Established
Established and serving questions; periodically re-announces.
Conflicting
Detected a conflict while probing; caller must rename and restart.
Implementations§
Source§impl ServiceState
impl ServiceState
Sourcepub const fn is_init(&self) -> bool
pub const fn is_init(&self) -> bool
Returns true if this value is of type Init. Returns false otherwise
Sourcepub const fn is_probing(&self) -> bool
pub const fn is_probing(&self) -> bool
Returns true if this value is of type Probing. Returns false otherwise
Sourcepub const fn is_announcing(&self) -> bool
pub const fn is_announcing(&self) -> bool
Returns true if this value is of type Announcing. Returns false otherwise
Sourcepub const fn is_established(&self) -> bool
pub const fn is_established(&self) -> bool
Returns true if this value is of type Established. Returns false otherwise
Sourcepub const fn is_conflicting(&self) -> bool
pub const fn is_conflicting(&self) -> bool
Returns true if this value is of type Conflicting. Returns false otherwise
Source§impl ServiceState
impl ServiceState
Sourcepub fn unwrap_init(self)
pub fn unwrap_init(self)
Unwraps this value to the ServiceState::Init variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_probing(self) -> u8
pub fn unwrap_probing(self) -> u8
Unwraps this value to the ServiceState::Probing variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_announcing(self) -> u8
pub fn unwrap_announcing(self) -> u8
Unwraps this value to the ServiceState::Announcing variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_established(self)
pub fn unwrap_established(self)
Unwraps this value to the ServiceState::Established variant.
Panics if this value is of any other type.
Sourcepub fn unwrap_conflicting(self)
pub fn unwrap_conflicting(self)
Unwraps this value to the ServiceState::Conflicting variant.
Panics if this value is of any other type.
Source§impl ServiceState
impl ServiceState
Sourcepub fn try_unwrap_init(self) -> Result<(), TryUnwrapError<Self>>
pub fn try_unwrap_init(self) -> Result<(), TryUnwrapError<Self>>
Attempts to unwrap this value to the ServiceState::Init variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_probing(self) -> Result<u8, TryUnwrapError<Self>>
pub fn try_unwrap_probing(self) -> Result<u8, TryUnwrapError<Self>>
Attempts to unwrap this value to the ServiceState::Probing variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_announcing(self) -> Result<u8, TryUnwrapError<Self>>
pub fn try_unwrap_announcing(self) -> Result<u8, TryUnwrapError<Self>>
Attempts to unwrap this value to the ServiceState::Announcing variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_established(self) -> Result<(), TryUnwrapError<Self>>
pub fn try_unwrap_established(self) -> Result<(), TryUnwrapError<Self>>
Attempts to unwrap this value to the ServiceState::Established variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Sourcepub fn try_unwrap_conflicting(self) -> Result<(), TryUnwrapError<Self>>
pub fn try_unwrap_conflicting(self) -> Result<(), TryUnwrapError<Self>>
Attempts to unwrap this value to the ServiceState::Conflicting variant.
Returns a [TryUnwrapError] with the original value if this value is of any other type.
Trait Implementations§
Source§impl Clone for ServiceState
impl Clone for ServiceState
Source§fn clone(&self) -> ServiceState
fn clone(&self) -> ServiceState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ServiceState
Source§impl Debug for ServiceState
impl Debug for ServiceState
Source§impl Display for ServiceState
impl Display for ServiceState
impl Eq for ServiceState
Source§impl Hash for ServiceState
impl Hash for ServiceState
Source§impl PartialEq for ServiceState
impl PartialEq for ServiceState
Source§fn eq(&self, other: &ServiceState) -> bool
fn eq(&self, other: &ServiceState) -> bool
self and other values to be equal, and is used by ==.