1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//! `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
//! ```
//! # tokio_test::block_on(async {
//! // 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
//! # Ok::<(), async_zeroconf::ZeroconfError>(())
//! # });
//! ```
//!
//! [`ServiceBrowserBuilder`] and [`ServiceResolver`] can be used to browse and
//! resolve services respectively.

#![warn(clippy::doc_markdown, missing_docs)]

mod c_intf;
mod error;
mod interface;
mod service;
mod service_browser;
mod service_ref;
mod service_resolver;
mod txt;

pub(crate) use service_ref::ServiceRefWrapper;

pub use error::{BonjourError, ZeroconfError};
pub use interface::Interface;
pub use service::Service;
pub use service_browser::{ServiceBrowser, ServiceBrowserBuilder};
pub use service_ref::{OpKind, OpType, ProcessTask, ServiceRef};
pub use service_resolver::ServiceResolver;
pub use txt::TxtRecord;

#[cfg(test)]
mod tests;

#[cfg(doctest)]
extern crate doc_comment;

#[cfg(doctest)]
doc_comment::doctest!("../README.md");