ServerOptions

Struct ServerOptions 

Source
pub struct ServerOptions { /* private fields */ }
Expand description

The options for [Server].

Implementations§

Source§

impl ServerOptions

Source

pub const fn new() -> Self

Returns a new instance of ServerOptions.

Source

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)));
Source

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));
Source

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));
Source

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);
Source

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);
Source

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);
Source

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);
Source

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

Source§

fn clone(&self) -> ServerOptions

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ServerOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ServerOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more