Struct mdns_sd::ServiceInfo
source · [−]pub struct ServiceInfo { /* private fields */ }Expand description
Complete info about a Service Instance.
We can construct some PTR, one SRV and one TXT record from this info, as well as A (IPv4 Address) records.
Implementations
sourceimpl ServiceInfo
impl ServiceInfo
sourcepub fn new<Ip: AsIpv4Addrs>(
ty_domain: &str,
my_name: &str,
host_name: &str,
host_ipv4: Ip,
port: u16,
properties: Option<HashMap<String, String>>
) -> Result<Self>
pub fn new<Ip: AsIpv4Addrs>(
ty_domain: &str,
my_name: &str,
host_name: &str,
host_ipv4: Ip,
port: u16,
properties: Option<HashMap<String, String>>
) -> Result<Self>
Creates a new service info.
ty_domain is the service type and the domain label, for example
“_my-service._udp.local.”.
my_name is the instance name, without the service type suffix.
properties are optional key/value pairs for the service.
host_ipv4 can be one or more IPv4 addresses, in a type that implements
AsIpv4Addrs trait. It supports:
- Single IPv4:
"192.168.0.1" - Multiple IPv4 separated by comma:
"192.168.0.1,192.168.0.2" - A slice of IPv4:
&["192.168.0.1", "192.168.0.2"] - All the above formats with Ipv4Addr or
Stringinstead of&str.
The host TTL and other TTL are set to default values.
sourcepub fn get_type(&self) -> &str
pub fn get_type(&self) -> &str
Returns the service type including the domain label.
For example: “_my-service._udp.local.”.
sourcepub fn get_subtype(&self) -> &Option<String>
pub fn get_subtype(&self) -> &Option<String>
Returns the service subtype including the domain label, if subtype has been defined.
For example: “_printer._sub._http._tcp.local.”.
sourcepub fn get_fullname(&self) -> &str
pub fn get_fullname(&self) -> &str
Returns a reference of the service fullname.
This is useful, for example, in unregister.
sourcepub fn get_properties(&self) -> &HashMap<String, String>
pub fn get_properties(&self) -> &HashMap<String, String>
Returns a reference of the properties from TXT records.
sourcepub fn get_hostname(&self) -> &str
pub fn get_hostname(&self) -> &str
Returns the service’s hostname.
sourcepub fn get_addresses(&self) -> &HashSet<Ipv4Addr>
pub fn get_addresses(&self) -> &HashSet<Ipv4Addr>
Returns the service’s addresses
sourcepub fn get_host_ttl(&self) -> u32
pub fn get_host_ttl(&self) -> u32
Returns the service’s TTL used for SRV and Address records.
sourcepub fn get_other_ttl(&self) -> u32
pub fn get_other_ttl(&self) -> u32
Returns the service’s TTL used for PTR and TXT records.
sourcepub fn get_priority(&self) -> u16
pub fn get_priority(&self) -> u16
Returns the service’s priority used in SRV records.
sourcepub fn get_weight(&self) -> u16
pub fn get_weight(&self) -> u16
Returns the service’s weight used in SRV records.
Trait Implementations
sourceimpl Clone for ServiceInfo
impl Clone for ServiceInfo
sourcefn clone(&self) -> ServiceInfo
fn clone(&self) -> ServiceInfo
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl RefUnwindSafe for ServiceInfo
impl Send for ServiceInfo
impl Sync for ServiceInfo
impl Unpin for ServiceInfo
impl UnwindSafe for ServiceInfo
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more