[][src]Struct homie_device::Property

pub struct Property {
    pub id: String,
    pub name: String,
    pub datatype: Datatype,
    pub settable: bool,
    pub unit: Option<String>,
    pub format: Option<String>,
}

A property of a Homie node.

Fields

id: Stringname: Stringdatatype: Datatypesettable: boolunit: Option<String>format: Option<String>

Implementations

impl Property[src]

pub fn new(
    id: &str,
    name: &str,
    datatype: Datatype,
    settable: bool,
    unit: Option<&str>,
    format: Option<&str>
) -> Property
[src]

Create a new property with the given attributes.

Arguments

  • id: The topic ID for the property. This must be unique per node, and follow the Homie ID format.
  • name: The human-readable name of the property.
  • datatype: The data type of the property.
  • settable: Whether the property can be set by the Homie controller. This should be true for properties like the brightness or power state of a light, and false for things like the temperature reading of a sensor.
  • unit: The unit for the property, if any. This may be one of the recommended units, or any other custom unit.
  • format: The format for the property, if any. This must be specified if the datatype is Enum or Color, and may be specified if the datatype is Integer or Float.

Trait Implementations

impl Clone for Property[src]

impl Debug for Property[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.