[][src]Trait homie_controller::Value

pub trait Value: ToString + FromStr {
    pub fn datatype() -> Datatype;

    pub fn valid_for(
        datatype: Option<Datatype>,
        format: &Option<String>
    ) -> Result<(), ValueError> { ... }
pub fn valid_for_format(_format: &str) -> Result<(), ValueError> { ... } }

The value of a Homie property. This has implementations corresponding to the possible property datatypes.

Required methods

pub fn datatype() -> Datatype[src]

The Homie datatype corresponding to this type.

Loading content...

Provided methods

pub fn valid_for(
    datatype: Option<Datatype>,
    format: &Option<String>
) -> Result<(), ValueError>
[src]

Check whether this value type is valid for the given property datatype and format string.

Returns Ok(()) if so, or Err(WrongFormat(...)) or Err(WrongDatatype(...)) if not.

The default implementation checks the datatype, and delegates to valid_for_format to check the format.

pub fn valid_for_format(_format: &str) -> Result<(), ValueError>[src]

Check whether this value type is valid for the given property format string.

Returns Ok(()) if so, or Err(WrongFormat(...)) if not.

Loading content...

Implementations on Foreign Types

impl Value for i64[src]

impl Value for f64[src]

impl Value for bool[src]

impl Value for String[src]

Loading content...

Implementors

impl Value for EnumValue[src]

impl<T: Color> Value for T[src]

Loading content...