Struct async_zeroconf::ServiceBrowserBuilder [−][src]
pub struct ServiceBrowserBuilder { /* fields omitted */ }
Expand description
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.
Note
This does not resolve the services so does not contain all information
associated with the service. A further resolve operation is required to
fully populate the service. This can be done with a ServiceResolver
.
Alternatively, the ServiceBrowser::recv_resolve
method can be
used to resolve the services inline, or ServiceBrowser::resolving
used
to convert the stream into one that resolves services before returning
them.
Examples
let mut browser = async_zeroconf::ServiceBrowserBuilder::new("_http._tcp");
let mut services = browser
.timeout(tokio::time::Duration::from_secs(2))
.browse()?;
while let Some(v) = services.recv().await {
println!("Service = {:?}", v);
}
Implementations
Create a new ServiceBrowserBuilder
for the specified service type
Set the interface for service discovery rather than all
Set the domain for service discovery rather than all
Start the browsing operation, which will continue until the specified
timeout or until the ServiceBrowser
is dropped.
Examples
let mut browser = async_zeroconf::ServiceBrowserBuilder::new("_http._tcp");
let mut services = browser
.timeout(tokio::time::Duration::from_secs(2))
.browse()?;
while let Some(Ok(v)) = services.recv().await {
println!("Service = {:?}", v);
}
Start the browsing operation, which will continue until the specified
timeout or until the ServiceBrowser
is dropped. The returned
ProcessTask
future must be awaited to process events associated with
the browser.
Note
This method is intended if more control is needed over how the task
is spawned. ServiceBrowserBuilder::browse
will automatically spawn
the task.
Examples
let mut browser = async_zeroconf::ServiceBrowserBuilder::new("_http._tcp");
let (mut services, task) = browser
.timeout(tokio::time::Duration::from_secs(2))
.browse_task()?;
tokio::spawn(task);
while let Some(Ok(v)) = services.recv().await {
println!("Service = {:?}", v);
}
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for ServiceBrowserBuilder
impl Send for ServiceBrowserBuilder
impl Sync for ServiceBrowserBuilder
impl Unpin for ServiceBrowserBuilder
impl UnwindSafe for ServiceBrowserBuilder
Blanket Implementations
Mutably borrows from an owned value. Read more