pub struct LanDiscovery {
daemon: ServiceDaemon,
instances: Arc<RwLock<HashMap<String, LanInstance>>>,
instance_id: String,
event_bus: Arc<EventBus>,
service_fullname: String,
}Fields§
§daemon: ServiceDaemon§instances: Arc<RwLock<HashMap<String, LanInstance>>>§instance_id: String§event_bus: Arc<EventBus>§service_fullname: StringImplementations§
Source§impl LanDiscovery
impl LanDiscovery
Sourcepub fn start(
instance_id: String,
hostname: String,
version: String,
port: u16,
event_bus: Arc<EventBus>,
) -> Result<Arc<Self>, String>
pub fn start( instance_id: String, hostname: String, version: String, port: u16, 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).
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.