Skip to main content

Service

Struct Service 

Source
pub struct Service<'a> {
    pub name: &'a str,
    pub priority: u16,
    pub weight: u16,
    pub service: &'a str,
    pub protocol: &'a str,
    pub port: u16,
    pub service_subtypes: &'a [&'a str],
    pub txt_kvs: &'a [(&'a str, &'a str)],
}
Expand description

A simple representation of a DNS-SD service that can be used to generate mDNS answers.

This structure (indirectly - via the ServiceAnswers wraper which also provides the hostname) implements the HostAnswers trait, which allows it to be used as a responder for mDNS queries coming from other network peers.

Fields§

§name: &'a str

The name of the service. I.e. “printer”

§priority: u16

The priority of the service.

§weight: u16

The weight of the service.

§service: &'a str

The service type. I.e. “_http”

§protocol: &'a str

The protocol of the service. I.e. “_tcp” or “_udp”

§port: u16

The TCP/UDP port where the service listens for incoming requests.

§service_subtypes: &'a [&'a str]

The subtypes of the service, if any.

§txt_kvs: &'a [(&'a str, &'a str)]

The key-value pairs that will be included in the TXT record, as per the DNS-SD spec.

Trait Implementations§

Source§

impl<'a> Clone for Service<'a>

Source§

fn clone(&self) -> Service<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Service<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Service<'a>

§

impl<'a> RefUnwindSafe for Service<'a>

§

impl<'a> Send for Service<'a>

§

impl<'a> Sync for Service<'a>

§

impl<'a> Unpin for Service<'a>

§

impl<'a> UnsafeUnpin for Service<'a>

§

impl<'a> UnwindSafe for Service<'a>

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, 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<Source, Target> OctetsInto<Target> for Source
where Target: OctetsFrom<Source>,

Source§

type Error = <Target as OctetsFrom<Source>>::Error

Source§

fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>

Performs the conversion.
Source§

fn octets_into(self) -> Target
where Self::Error: Into<Infallible>,

Performs an infallible conversion.
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.