agnostic_mdns/
worksteal.rs1use mdns_proto::proto::{Label, ResourceRecord, ResourceType};
2
3pub use agnostic_net as net;
4pub use async_channel as channel;
5pub use client::*;
6pub use server::*;
7
8mod client;
9mod server;
10
11#[cfg(test)]
12mod tests;
13
14pub trait Zone: core::fmt::Debug + Send + Sync + 'static {
17 type Error: core::error::Error + Send + Sync + 'static;
19
20 fn answers<'a>(
22 &'a self,
23 name: Label<'a>,
24 rt: ResourceType,
25 ) -> impl Future<Output = Result<impl Iterator<Item = ResourceRecord<'a>> + 'a, Self::Error>> + Send + 'a;
26
27 fn additionals<'a>(
29 &'a self,
30 name: Label<'a>,
31 rt: ResourceType,
32 ) -> impl Future<Output = Result<impl Iterator<Item = ResourceRecord<'a>> + 'a, Self::Error>> + Send + 'a;
33}
34
35impl Zone for super::service::Service {
36 type Error = core::convert::Infallible;
37
38 async fn answers<'a>(
39 &'a self,
40 name: Label<'a>,
41 rt: ResourceType,
42 ) -> Result<impl Iterator<Item = ResourceRecord<'a>> + 'a, Self::Error> {
43 Ok(self.fetch_answers(name, rt))
44 }
45
46 async fn additionals<'a>(
47 &'a self,
48 _: Label<'a>,
49 _: ResourceType,
50 ) -> Result<impl Iterator<Item = ResourceRecord<'a>> + 'a, Self::Error> {
51 Ok(core::iter::empty())
52 }
53}