diff --git a/zeroconf/src/lib.rs b/zeroconf/src/lib.rs index 78f6bb3..e620beb 100644 --- a/zeroconf/src/lib.rs +++ b/zeroconf/src/lib.rs @@ -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")] diff --git a/zeroconf/src/registration.rs b/zeroconf/src/registration.rs deleted file mode 100644 index 79b8450..0000000 --- a/zeroconf/src/registration.rs +++ /dev/null @@ -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, Option>); - -/// 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, -} diff --git a/zeroconf/src/service.rs b/zeroconf/src/service.rs index 82bf60e..3cb5312 100644 --- a/zeroconf/src/service.rs +++ b/zeroconf/src/service.rs @@ -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; } + +/// 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, Option>); + +/// 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, +}