Skip to main content

Identity

Struct Identity 

Source
#[non_exhaustive]
pub struct Identity {
Show 19 fields pub device_ids: Vec<String>, pub roles: Vec<String>, pub manufacturer: String, pub model: String, pub serial_number: String, pub ebus_version: String, pub device_type: Option<String>, pub name: Option<String>, pub fw_version: Option<String>, pub register: Option<String>, pub broker_ca: Option<String>, pub auth_methods: Vec<String>, pub hw_version: Option<String>, pub os_version: Option<String>, pub mac: Option<String>, pub extra_ebus_txt: Vec<(String, String)>, pub extra_device_info_txt: Vec<(String, String)>, pub homie_domain: Option<String>, pub homie_version: Option<String>,
}
Available on crate feature alloc only.
Expand description

An entity’s _ebus._tcp and _device-info._tcp content (ebus.py:330-438).

One _ebus._tcp advertisement covers the whole host, so device_ids may list several devices, joined with commas into device_id. Recommended keys left empty are omitted. Extra keys never replace a key the identity sets.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§device_ids: Vec<String>

The host’s device ids; the first is the default instance name.

§roles: Vec<String>

device, controller, broker-host.

§manufacturer: String

Required.

§model: String

Required.

§serial_number: String

Required, in _device-info._tcp.

§ebus_version: String

Defaults to EBUS_VERSION.

§device_type: Option<String>

device_type.

§name: Option<String>

name.

§fw_version: Option<String>

fw_version, in both records.

§register: Option<String>

register: the registration endpoint path.

§broker_ca: Option<String>

broker_ca: the broker CA download path.

§auth_methods: Vec<String>

auth_methods.

§hw_version: Option<String>

hw_version, in _device-info._tcp.

§os_version: Option<String>

os_version, in _device-info._tcp.

§mac: Option<String>

mac, in _device-info._tcp.

§extra_ebus_txt: Vec<(String, String)>

Keys the specification does not define, appended to _ebus._tcp.

§extra_device_info_txt: Vec<(String, String)>

Keys the specification does not define, appended to _device-info._tcp.

§homie_domain: Option<String>

The Homie domain the host publishes under; adds homie_domain, homie_version and homie_roles to _ebus._tcp.

§homie_version: Option<String>

homie_version with homie_domain; defaults to 5.

Implementations§

Source§

impl Identity

Source

pub fn new<D, R>( device_ids: impl IntoIterator<Item = D>, roles: impl IntoIterator<Item = R>, manufacturer: &str, model: &str, serial_number: &str, ) -> Self
where D: Into<String>, R: Into<String>,

An identity with the required fields; every other field empty.

Source

pub fn device_id(&self) -> String

The device_id value: the device ids joined with commas.

Source

pub fn check(&self) -> Result<(), TxtError>

Check the required fields and both records (ebus.py:371-393).

Source

pub fn ebus_txt(&self) -> TxtRecord

The _ebus._tcp record, keys in python’s order (ebus.py:400-422).

Source

pub fn device_info_txt(&self) -> TxtRecord

The _device-info._tcp record (ebus.py:424-438).

Trait Implementations§

Source§

impl Clone for Identity

Source§

fn clone(&self) -> Self

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 Debug for Identity

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for Identity

Source§

impl PartialEq for Identity

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Identity

Auto Trait Implementations§

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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.