Crate async_zeroconf[−][src]
Expand description
async-zeroconf
is a crate to register ZeroConf
services and provides a
way of keeping the service alive using a reference to the service which
keeps the service registered until it is dropped. Internally, a tokio task
is spawned to check for events asynchronously.
Examples
// Create a service description
let service = async_zeroconf::Service::new("Server", "_http._tcp", 80);
// Publish the service
let service_ref = service.publish().await?;
// Service kept alive until service_ref dropped
ServiceBrowserBuilder
and ServiceResolver
can be used to browse and
resolve services respectively.
Structs
OpType
is used to indicate the service type and the kind of operation
associated with a ServiceRef
. Primarily intended for debug.
Struct representing a ZeroConf
service. This should be created with all
the information that should be associated with the service and then the
publish
method can be used to register the service.
The ServiceRef
returned from publish
should be held
for as long as the service should continue being advertised, once dropped
the service will be deallocated.
Struct used to get the results of a service browser which should be
constructed with a ServiceBrowserBuilder
.
ServiceBrowserBuilder
is used to browse for services. Once all the
required information is added to the ServiceBrowserBuilder
the
browse
method will produce a
ServiceBrowser
which can be used as a stream, or the
ServiceBrowser::recv
method will produce the next service found.
Struct to hold a published service, which keeps the service alive while a reference to it is held. When dropped the Service will be removed and any associated resources deallocated.
ServiceResolver
is used resolve a service obtained from a
ServiceBrowser
. Browsing does not obtain all
information about a service, for example it doesn’t include port
information, and resolving the service will fill this information in.
Struct containing the entries for TXT records associated with a service
Enums
An error from the Bonjour API
Enum to hold the Interface a service should be advertised on.
OpKind
represents the possible kinds of operation associated with a
ServiceRef
, primarily used for debug and obtained from the OpType
returned by ServiceRef::op_type
.
Custom error holding any potential errors from publishing or browsing for services.
Traits
The ProcessTask
trait represents the future that is returned from some
functions that is awaited on to process events associated with a published
service or a browse operation.