pub struct ServiceRegistrationBuilder { /* private fields */ }Expand description
Builder for DNS-SD service registrations.
See RFC 6763 for details on the semantics of the various parameters.
Implementations§
Source§impl ServiceRegistrationBuilder
impl ServiceRegistrationBuilder
Sourcepub fn new(service_type: impl AsRef<str>, port: u16) -> Self
pub fn new(service_type: impl AsRef<str>, port: u16) -> Self
Initializes a new service registration builder with the given service type and port.
-
service_type: The service type followed by the protocol, separated by a dot (e.g._ftp._tcp). The service type must be an underscore, followed by 1-15 characters, which may be letters, digits, or hyphens. The transport protocol must be_tcpor_udp. New service types should be registered at http://www.dns-sd.org/ServiceTypes.html. -
port: The UDP/TCP port on which the service accepts connections.Pass 0 for a “placeholder” service (i.e. a service that will not be discovered by browsing, but will cause a name conflict if another client tries to register that same name). Most clients will not use placeholder services.
Sourcepub fn name(&mut self, name: impl AsRef<str>) -> &mut Self
pub fn name(&mut self, name: impl AsRef<str>) -> &mut Self
Specifies the service name to be registered.
Most applications will not specify a name, in which case the computer name is used. If a name is specified, it must be 1-63 bytes of UTF-8 text.
Sourcepub fn add_txt_record_key_empty(&mut self, key: impl AsRef<str>) -> &mut Self
pub fn add_txt_record_key_empty(&mut self, key: impl AsRef<str>) -> &mut Self
Adds a TXT record key to the service registration, with an empty value.
Sourcepub fn add_txt_record_key_string(
&mut self,
key: impl AsRef<str>,
value: impl AsRef<str>,
) -> &mut Self
pub fn add_txt_record_key_string( &mut self, key: impl AsRef<str>, value: impl AsRef<str>, ) -> &mut Self
Adds a TXT record key/value pair to the service registration.
Windows limitation: if value is an empty string, it will be treated as a key-only pair.
Sourcepub fn add_txt_record_key_binary(
&mut self,
key: impl AsRef<str>,
value: impl AsRef<[u8]>,
) -> &mut Self
pub fn add_txt_record_key_binary( &mut self, key: impl AsRef<str>, value: impl AsRef<[u8]>, ) -> &mut Self
Adds a TXT record key/value pair to the service registration, with a binary value.
Sourcepub fn interface_index(&mut self, index: NonZeroU32) -> &mut Self
pub fn interface_index(&mut self, index: NonZeroU32) -> &mut Self
Specifies the interface on which to register the service
(the index for a given interface is determined via the if_nametoindex()
family of calls.)
Most applications will not specify an interface, instead automatically registering on all available interfaces.
Sourcepub fn host(&mut self, host: impl AsRef<str>) -> &mut Self
pub fn host(&mut self, host: impl AsRef<str>) -> &mut Self
Set the SRV target host name.
Most applications will not specify a host, instead automatically using the machine’s default host name(s).
Note that specifying a host does NOT create an address record for that host.
Sourcepub fn domain(&mut self, domain: impl AsRef<str>) -> &mut Self
pub fn domain(&mut self, domain: impl AsRef<str>) -> &mut Self
Set the domain on which to advertise the service.
Most applications will not specify a domain, instead automatically registering in the default domain(s).
Sourcepub async fn register(
&self,
) -> Result<ServiceRegistration, ServiceRegistrationError>
pub async fn register( &self, ) -> Result<ServiceRegistration, ServiceRegistrationError>
Registers the service with the system, making it discoverable by remote clients.
Trait Implementations§
Source§impl Clone for ServiceRegistrationBuilder
impl Clone for ServiceRegistrationBuilder
Source§fn clone(&self) -> ServiceRegistrationBuilder
fn clone(&self) -> ServiceRegistrationBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more