pub struct ServiceInfo<'a, const LLEN: usize = 4> { /* private fields */ }Expand description
Information about a service to declare over mDNS.
Implementations§
Source§impl<'a, const LLEN: usize> ServiceInfo<'a, LLEN>
impl<'a, const LLEN: usize> ServiceInfo<'a, LLEN>
Sourcepub fn new(
service_type: &'a str,
instance_name: &'a str,
hostname: &'a str,
ip_address: impl Into<IpAddr>,
netmask: impl Into<IpAddr>,
port: u16,
) -> Self
pub fn new( service_type: &'a str, instance_name: &'a str, hostname: &'a str, ip_address: impl Into<IpAddr>, netmask: impl Into<IpAddr>, port: u16, ) -> Self
Creates information about a new service.
use opslag::ServiceInfo;
let info = ServiceInfo::<4>::new(
"_my-service._udp.local", // Name of my service, same for all nodes
"instance01", // This specific service instance
"nugget.local", // My host name (<some_name>.local)
[192, 168, 0, 3], // The IP for my host name
[255, 255, 255, 0], // Netmask for the IP
1234, // The port the service is running on
);Sourcepub fn service_type(&self) -> &Label<'a, LLEN>
pub fn service_type(&self) -> &Label<'a, LLEN>
The type of service.
Example: _my-service._tcp.local
Sourcepub fn instance_name(&self) -> &Label<'a, LLEN>
pub fn instance_name(&self) -> &Label<'a, LLEN>
The instance name.
Example: myinstance01
Sourcepub fn hostname(&self) -> &Label<'a, LLEN>
pub fn hostname(&self) -> &Label<'a, LLEN>
The host name the service is running on.
Example: Martin's Macbook Air.local
Sourcepub fn ip_address(&self) -> IpAddr
pub fn ip_address(&self) -> IpAddr
Corresponding IP address for the host name.
Example: 192.160.10.24
Trait Implementations§
Auto Trait Implementations§
impl<'a, const LLEN: usize> Freeze for ServiceInfo<'a, LLEN>
impl<'a, const LLEN: usize> RefUnwindSafe for ServiceInfo<'a, LLEN>
impl<'a, const LLEN: usize> Send for ServiceInfo<'a, LLEN>
impl<'a, const LLEN: usize> Sync for ServiceInfo<'a, LLEN>
impl<'a, const LLEN: usize> Unpin for ServiceInfo<'a, LLEN>
impl<'a, const LLEN: usize> UnwindSafe for ServiceInfo<'a, LLEN>
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
Mutably borrows from an owned value. Read more