pub struct ServerOptions { /* private fields */ }Expand description
The options for [Server].
Implementations§
Source§impl ServerOptions
impl ServerOptions
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Returns a new instance of ServerOptions.
Sourcepub const fn ipv4_interface(&self) -> Option<&Ipv4Addr>
pub const fn ipv4_interface(&self) -> Option<&Ipv4Addr>
Returns the Ipv4 interface to bind the multicast listener to.
§Example
use agnostic_mdns::ServerOptions;
use std::net::Ipv4Addr;
let opts = ServerOptions::new().with_ipv4_interface(Ipv4Addr::new(192, 168, 1, 1));
assert_eq!(opts.ipv4_interface(), Some(&Ipv4Addr::new(192, 168, 1, 1)));Sourcepub fn with_ipv4_interface(self, iface: Ipv4Addr) -> Self
pub fn with_ipv4_interface(self, iface: Ipv4Addr) -> Self
Sets the IPv4 interface to bind the multicast listener to.
§Example
use agnostic_mdns::ServerOptions;
use std::net::Ipv4Addr;
let opts = ServerOptions::new().with_ipv4_interface(Ipv4Addr::new(192, 168, 1, 1));Sourcepub const fn ipv6_interface(&self) -> Option<u32>
pub const fn ipv6_interface(&self) -> Option<u32>
Returns the Ipv6 interface to bind the multicast listener to.
§Example
use agnostic_mdns::ServerOptions;
let opts = ServerOptions::new().with_ipv6_interface(1);
assert_eq!(opts.ipv6_interface(), Some(1));Sourcepub fn with_ipv6_interface(self, index: u32) -> Self
pub fn with_ipv6_interface(self, index: u32) -> Self
Sets the IPv6 interface to bind the multicast listener to.
§Example
use agnostic_mdns::ServerOptions;
let opts = ServerOptions::new().with_ipv6_interface(1);Sourcepub fn with_log_empty_responses(self, log_empty_responses: bool) -> Self
pub fn with_log_empty_responses(self, log_empty_responses: bool) -> Self
Sets whether the server should print an informative message when there is an mDNS query for which the server has no response.
Default is false.
§Example
use agnostic_mdns::ServerOptions;
let opts = ServerOptions::new().with_log_empty_responses(true);
assert_eq!(opts.log_empty_responses(), true);Sourcepub const fn log_empty_responses(&self) -> bool
pub const fn log_empty_responses(&self) -> bool
Returns whether the server should print an informative message when there is an mDNS query for which the server has no response.
§Example
use agnostic_mdns::ServerOptions;
let opts = ServerOptions::new().with_log_empty_responses(true);
assert_eq!(opts.log_empty_responses(), true);Sourcepub const fn max_payload_size(&self) -> usize
pub const fn max_payload_size(&self) -> usize
Returns the configured maximum payload size for mDNS message packets.
This value limits how large each mDNS packet can be when sending queries or receiving responses.
Smaller values may be necessary on networks with MTU constraints or when working with devices that have limited buffer sizes.
Default is 1500 bytes.
§Example
use agnostic_mdns::ServerOptions;
let opts = ServerOptions::new().with_max_payload_size(1500);Sourcepub const fn with_max_payload_size(self, max_payload_size: usize) -> Self
pub const fn with_max_payload_size(self, max_payload_size: usize) -> Self
Sets the maximum payload size for mDNS message packets.
This controls how large each mDNS packet can be when sending queries or receiving responses.
You might want to adjust this value to:
- Reduce the size to avoid IP fragmentation on networks with lower MTUs
- Match device-specific constraints in IoT environments
- Optimize for specific network conditions
Default is 1500 bytes.
§Example
use agnostic_mdns::ServerOptions;
let opts = ServerOptions::new().with_max_payload_size(1500);
assert_eq!(opts.max_payload_size(), 1500);Trait Implementations§
Source§impl Clone for ServerOptions
impl Clone for ServerOptions
Source§fn clone(&self) -> ServerOptions
fn clone(&self) -> ServerOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ServerOptions
impl Debug for ServerOptions
Auto Trait Implementations§
impl Freeze for ServerOptions
impl RefUnwindSafe for ServerOptions
impl Send for ServerOptions
impl Sync for ServerOptions
impl Unpin for ServerOptions
impl UnwindSafe for ServerOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more