async_zeroconf/
lib.rs

1//! `async-zeroconf` is a crate to register `ZeroConf` services and provides a
2//! way of keeping the service alive using a reference to the service which
3//! keeps the service registered until it is dropped. Internally, a tokio task
4//! is spawned to check for events asynchronously.
5//!
6//! # Examples
7//! ```
8//! # tokio_test::block_on(async {
9//! // Create a service description
10//! let service = async_zeroconf::Service::new("Server", "_http._tcp", 80);
11//! // Publish the service
12//! let service_ref = service.publish().await?;
13//! // Service kept alive until service_ref dropped
14//! # Ok::<(), async_zeroconf::ZeroconfError>(())
15//! # });
16//! ```
17//!
18//! [`ServiceBrowserBuilder`] and [`ServiceResolver`] can be used to browse and
19//! resolve services respectively.
20
21#![warn(clippy::doc_markdown, missing_docs)]
22
23mod c_intf;
24mod error;
25mod interface;
26mod service;
27mod service_browser;
28mod service_ref;
29mod service_resolver;
30mod txt;
31
32pub(crate) use service_ref::ServiceRefWrapper;
33
34pub use error::{BonjourError, ZeroconfError};
35pub use interface::Interface;
36pub use service::Service;
37pub use service_browser::{ServiceBrowser, ServiceBrowserBuilder};
38pub use service_ref::{OpKind, OpType, ProcessTask, ServiceRef};
39pub use service_resolver::ServiceResolver;
40pub use txt::TxtRecord;
41
42#[cfg(test)]
43mod tests;
44
45#[cfg(doctest)]
46extern crate doc_comment;
47
48#[cfg(doctest)]
49doc_comment::doctest!("../README.md");