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 droppedServiceBrowserBuilder and ServiceResolver can be used to browse and
resolve services respectively.
Structs§
- OpType
OpTypeis used to indicate the service type and the kind of operation associated with aServiceRef. Primarily intended for debug.- Service
- Struct representing a
ZeroConfservice. This should be created with all the information that should be associated with the service and then thepublishmethod can be used to register the service. TheServiceRefreturned frompublishshould be held for as long as the service should continue being advertised, once dropped the service will be deallocated. - Service
Browser - Struct used to get the results of a service browser which should be
constructed with a
ServiceBrowserBuilder. - Service
Browser Builder ServiceBrowserBuilderis used to browse for services. Once all the required information is added to theServiceBrowserBuilderthebrowsemethod will produce aServiceBrowserwhich can be used as a stream, or theServiceBrowser::recvmethod will produce the next service found.- Service
Ref - 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.
- Service
Resolver ServiceResolveris used resolve a service obtained from aServiceBrowser. 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.- TxtRecord
- Struct containing the entries for TXT records associated with a service
Enums§
- Bonjour
Error - An error from the Bonjour API
- Interface
- Enum to hold the Interface a service should be advertised on.
- OpKind
OpKindrepresents the possible kinds of operation associated with aServiceRef, primarily used for debug and obtained from theOpTypereturned byServiceRef::op_type.- Zeroconf
Error - Custom error holding any potential errors from publishing or browsing for services.
Traits§
- Process
Task - The
ProcessTasktrait 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.