combine files

Signed-off-by: Walker Crouse <walker.crouse@coop.co.uk>
This commit is contained in:
Walker Crouse 2020-09-29 10:38:46 -04:00
parent 4314369bf6
commit fefdaa4f2c
3 changed files with 22 additions and 25 deletions

View File

@ -129,7 +129,6 @@ extern crate derive_new;
#[allow(unused_imports)]
extern crate maplit;
mod registration;
#[macro_use]
mod macros;
mod interface;
@ -152,7 +151,7 @@ pub mod macos;
pub use browser::{ServiceDiscoveredCallback, ServiceDiscovery};
pub use interface::*;
pub use registration::*;
pub use service::{ServiceRegisteredCallback, ServiceRegistration};
/// Type alias for the platform-specific mDNS browser implementation
#[cfg(target_os = "linux")]

View File

@ -1,22 +0,0 @@
use std::any::Any;
use std::sync::Arc;
/// Callback invoked from [`MdnsService`] once it has successfully registered.
///
/// # Arguments
/// * `service` - The service information that was registered
/// * `context` - The optional user context passed through
///
/// [`MdnsService`]: type.MdnsService.html
pub type ServiceRegisteredCallback =
dyn Fn(Result<ServiceRegistration, super::error::Error>, Option<Arc<dyn Any>>);
/// Represents a registration event for a [`MdnsService`].
///
/// [`MdnsService`]: type.MdnsService.html
#[derive(Builder, BuilderDelegate, Debug, Getters, Clone, Default, PartialEq, Eq)]
pub struct ServiceRegistration {
name: String,
kind: String,
domain: String,
}

View File

@ -1,7 +1,8 @@
//! Trait definition for cross-platform service.
use crate::{EventLoop, NetworkInterface, Result, ServiceRegisteredCallback, TxtRecord};
use crate::{EventLoop, NetworkInterface, Result, TxtRecord};
use std::any::Any;
use std::sync::Arc;
/// Interface for interacting with underlying mDNS service implementation registration
/// capabilities.
@ -47,3 +48,22 @@ pub trait TMdnsService {
/// the service alive.
fn register(&mut self) -> Result<EventLoop>;
}
/// Callback invoked from [`MdnsService`] once it has successfully registered.
///
/// # Arguments
/// * `service` - The service information that was registered
/// * `context` - The optional user context passed through
///
/// [`MdnsService`]: type.MdnsService.html
pub type ServiceRegisteredCallback = dyn Fn(Result<ServiceRegistration>, Option<Arc<dyn Any>>);
/// Represents a registration event for a [`MdnsService`].
///
/// [`MdnsService`]: type.MdnsService.html
#[derive(Builder, BuilderDelegate, Debug, Getters, Clone, Default, PartialEq, Eq)]
pub struct ServiceRegistration {
name: String,
kind: String,
domain: String,
}