[][src]Struct webthing::property::BaseProperty

pub struct BaseProperty { /* fields omitted */ }

Basic property implementation.

A Property represents an individual state value of a thing.

This can easily be used by other properties to handle most of the boring work.

Implementations

impl BaseProperty[src]

pub fn new(
    name: String,
    initial_value: Value,
    value_forwarder: Option<Box<dyn ValueForwarder>>,
    metadata: Option<Map<String, Value>>
) -> BaseProperty
[src]

Create a new BaseProperty.

Arguments

  • name - name of the property
  • initial_value - initial property value
  • value_forwarder - optional value forwarder; property will be read-only if None
  • metadata - property metadata, i.e. type, description, unit, etc., as a JSON map

Trait Implementations

impl Property for BaseProperty[src]

fn set_href_prefix(&mut self, prefix: String)[src]

Set the prefix of any hrefs associated with this property.

fn get_href(&self) -> String[src]

Get the href of this property.

fn get_value(&self) -> Value[src]

Get the current property value.

fn set_value(&mut self, value: Value) -> Result<(), &'static str>[src]

Set the current value of the property.

fn set_cached_value(&mut self, value: Value) -> Result<(), &'static str>[src]

Set the cached value of the property.

fn get_name(&self) -> String[src]

Get the name of this property.

fn get_metadata(&self) -> Map<String, Value>[src]

Get the metadata associated with this property.

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> Erased for T

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

impl<T> GetTypeId for T where
    T: Any
[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,