pub struct ServiceDaemon { /* private fields */ }
Expand description

A daemon thread for mDNS

This struct provides a handle and an API to the daemon. It is cloneable.

Implementations

Creates a new daemon and spawns a thread to run the daemon.

The daemon (re)uses the default mDNS port 5353. To keep it simple, we don’t ask callers to set the port.

Starts browsing for a specific service type.

Returns a channel Receiver to receive events about the service. The caller can call .recv_async().await on this receiver to handle events in an async environment or call .recv() in a sync environment.

When a new instance is found, the daemon automatically tries to resolve, i.e. finding more details, i.e. SRV records and TXT records.

Stops searching for a specific service type.

When an error is returned, the caller should retry only when the error is Error::Again, otherwise should log and move on.

Registers a service provided by this host.

Unregisters a service. This is a graceful shutdown of a service.

Returns a channel receiver that is used to receive the status code of the unregister.

When an error is returned, the caller should retry only when the error is Error::Again, otherwise should log and move on.

Shuts down the daemon thread.

When an error is returned, the caller should retry only when the error is Error::Again, otherwise should log and move on.

Returns a channel receiver for the metrics, e.g. input/output counters.

The metrics returned is a snapshot. Hence the caller should call this method repeatedly if they want to monitor the metrics continuously.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.