pub struct QueryParam<'a> { /* private fields */ }Expand description
How a lookup is performed.
Implementations§
Source§impl<'a> QueryParam<'a>
impl<'a> QueryParam<'a>
Sourcepub fn with_domain(self, domain: Label<'a>) -> Self
pub fn with_domain(self, domain: Label<'a>) -> Self
Sets the domain to search in.
§Example
use agnostic_mdns::QueryParam;
let params = QueryParam::new("service._tcp".into())
.with_domain("local.".into());Sourcepub const fn domain(&self) -> &Label<'a>
pub const fn domain(&self) -> &Label<'a>
Returns the domain to search in.
§Example
use agnostic_mdns::{QueryParam, Label};
let params = QueryParam::new("service._tcp".into())
.with_domain("local.".into());
assert_eq!(params.domain(), &Label::from("local"));Sourcepub fn with_service(self, service: Label<'a>) -> Self
pub fn with_service(self, service: Label<'a>) -> Self
Sets the service to search for.
§Example
use agnostic_mdns::QueryParam;
let params = QueryParam::new("service._tcp".into())
.with_service("service._udp".into());Sourcepub const fn service(&self) -> &Label<'a>
pub const fn service(&self) -> &Label<'a>
Returns the service to search for.
§Example
use agnostic_mdns::{QueryParam, Label};
let params = QueryParam::new("service._tcp".into())
.with_service("service._udp".into());
assert_eq!(params.service(), &Label::from("service._udp"));Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Sets the timeout for the query.
§Example
use agnostic_mdns::QueryParam;
let params = QueryParam::new("service._tcp".into())
.with_timeout(std::time::Duration::from_secs(1));Sourcepub const fn timeout(&self) -> Duration
pub const fn timeout(&self) -> Duration
Returns the timeout for the query.
§Example
use agnostic_mdns::QueryParam;
let params = QueryParam::new("service._tcp".into())
.with_timeout(std::time::Duration::from_secs(1));
assert_eq!(params.timeout(), std::time::Duration::from_secs(1));Sourcepub fn with_ipv4_interface(self, ipv4_interface: Ipv4Addr) -> Self
pub fn with_ipv4_interface(self, ipv4_interface: Ipv4Addr) -> Self
Sets the IPv4 interface to use for queries.
§Example
use agnostic_mdns::QueryParam;
let params = QueryParam::new("service._tcp".into())
.with_ipv4_interface("0.0.0.0".parse().unwrap());Sourcepub const fn ipv4_interface(&self) -> Option<&Ipv4Addr>
pub const fn ipv4_interface(&self) -> Option<&Ipv4Addr>
Returns the IPv4 interface to use for queries.
§Example
use agnostic_mdns::QueryParam;
let params = QueryParam::new("service._tcp".into())
.with_ipv4_interface("0.0.0.0".parse().unwrap());
assert_eq!(params.ipv4_interface().unwrap(), &"0.0.0.0".parse::<std::net::Ipv4Addr>().unwrap());Sourcepub fn with_ipv6_interface(self, ipv6_interface: u32) -> Self
pub fn with_ipv6_interface(self, ipv6_interface: u32) -> Self
Sets the IPv6 interface to use for queries.
§Example
use agnostic_mdns::QueryParam;
let params = QueryParam::new("service._tcp".into())
.with_ipv6_interface(1);Sourcepub const fn ipv6_interface(&self) -> Option<u32>
pub const fn ipv6_interface(&self) -> Option<u32>
Returns the IPv6 interface to use for queries.
§Example
use agnostic_mdns::QueryParam;
let params = QueryParam::new("service._tcp".into())
.with_ipv6_interface(1);
assert_eq!(params.ipv6_interface().unwrap(), 1);Sourcepub fn with_unicast_response(self, want_unicast_response: bool) -> Self
pub fn with_unicast_response(self, want_unicast_response: bool) -> Self
Sets whether to request unicast responses.
§Example
use agnostic_mdns::QueryParam;
let params = QueryParam::new("service._tcp".into())
.with_unicast_response(true);Sourcepub const fn want_unicast_response(&self) -> bool
pub const fn want_unicast_response(&self) -> bool
Returns whether to request unicast responses.
§Example
use agnostic_mdns::QueryParam;
let params = QueryParam::new("service._tcp".into())
.with_unicast_response(true);
assert_eq!(params.want_unicast_response(), true);Sourcepub fn with_disable_ipv4(self, disable_ipv4: bool) -> Self
pub fn with_disable_ipv4(self, disable_ipv4: bool) -> Self
Sets whether to disable IPv4 for MDNS operations.
§Example
use agnostic_mdns::QueryParam;
let params = QueryParam::new("service._tcp".into())
.with_disable_ipv4(true);Sourcepub const fn disable_ipv4(&self) -> bool
pub const fn disable_ipv4(&self) -> bool
Returns whether to disable IPv4 for MDNS operations.
§Example
use agnostic_mdns::QueryParam;
let params = QueryParam::new("service._tcp".into())
.with_disable_ipv4(true);
assert_eq!(params.disable_ipv4(), true);Sourcepub fn with_disable_ipv6(self, disable_ipv6: bool) -> Self
pub fn with_disable_ipv6(self, disable_ipv6: bool) -> Self
Sets whether to disable IPv6 for MDNS operations.
§Example
use agnostic_mdns::QueryParam;
let params = QueryParam::new("service._tcp".into())
.with_disable_ipv6(true);Sourcepub const fn disable_ipv6(&self) -> bool
pub const fn disable_ipv6(&self) -> bool
Returns whether to disable IPv6 for MDNS operations.
§Example
use agnostic_mdns::QueryParam;
let params = QueryParam::new("service._tcp".into())
.with_disable_ipv6(true);
assert_eq!(params.disable_ipv6(), 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::QueryParam;
let params = QueryParam::new("service._tcp".into())
.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::QueryParam;
let params = QueryParam::new("service._tcp".into())
.with_max_payload_size(1500);
assert_eq!(params.max_payload_size(), 1500);Sourcepub const fn capacity(&self) -> Option<usize>
pub const fn capacity(&self) -> Option<usize>
Returns the channel capacity for the [Lookup] stream.
If None, the channel is unbounded.
Default is None.
§Example
use agnostic_mdns::QueryParam;
let params = QueryParam::new("service._tcp".into())
.with_capacity(Some(10));
assert_eq!(params.capacity().unwrap(), 10);Sourcepub fn with_capacity(self, cap: Option<usize>) -> Self
pub fn with_capacity(self, cap: Option<usize>) -> Self
Sets the channel capacity for the [Lookup] stream.
If None, the channel is unbounded.
Default is None.
§Example
use agnostic_mdns::QueryParam;
let params = QueryParam::new("service._tcp".into())
.with_capacity(Some(10));Trait Implementations§
Source§impl<'a> Clone for QueryParam<'a>
impl<'a> Clone for QueryParam<'a>
Source§fn clone(&self) -> QueryParam<'a>
fn clone(&self) -> QueryParam<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for QueryParam<'a>
impl<'a> RefUnwindSafe for QueryParam<'a>
impl<'a> Send for QueryParam<'a>
impl<'a> Sync for QueryParam<'a>
impl<'a> Unpin for QueryParam<'a>
impl<'a> UnwindSafe for QueryParam<'a>
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