pub struct LanDiscovery {
daemon: ServiceDaemon,
instances: Arc<RwLock<HashMap<String, LanInstance>>>,
instance_id: String,
event_bus: Arc<EventBus>,
service_fullname: String,
auth_key: String,
}Fields§
§daemon: ServiceDaemon§instances: Arc<RwLock<HashMap<String, LanInstance>>>§instance_id: String§event_bus: Arc<EventBus>§service_fullname: String§auth_key: StringImplementations§
Source§impl LanDiscovery
impl LanDiscovery
Sourcepub fn start(
instance_id: String,
hostname: String,
version: String,
port: u16,
auth_key: String,
event_bus: Arc<EventBus>,
) -> Result<Arc<Self>, String>
pub fn start( instance_id: String, hostname: String, version: String, port: u16, auth_key: String, event_bus: Arc<EventBus>, ) -> Result<Arc<Self>, String>
Start LAN discovery: register this instance and browse for peers.
fn event_loop(&self, receiver: Receiver<ServiceEvent>)
fn handle_event(&self, event: ServiceEvent)
fn broadcast_instances(&self)
Sourcepub fn get_instances(&self) -> Vec<LanInstance>
pub fn get_instances(&self) -> Vec<LanInstance>
Get current list of discovered LAN peers (excludes self).
Sourcepub fn peer_count(&self) -> usize
pub fn peer_count(&self) -> usize
Get peer count (excludes self).
Sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Stop the mDNS daemon — synchronously closes the daemon socket
(UDP:5353), causing the browse_receiver to return Err and the
event-loop thread spawned by start() to exit.
Required for live-disable to actually stop discovery: the event-loop
thread holds its own Arc<Self> clone, so simply dropping the
controller’s Arc never reaches refcount zero and Drop does not
run. Callers must invoke shutdown() before clearing their Arc.
Idempotent — safe to call from both the explicit path and Drop.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LanDiscovery
impl !RefUnwindSafe for LanDiscovery
impl Send for LanDiscovery
impl Sync for LanDiscovery
impl Unpin for LanDiscovery
impl !UnwindSafe for LanDiscovery
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more