Struct webthing::property::BaseProperty [−][src]
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.
Methods
impl BaseProperty
[src]
impl BaseProperty
pub fn new(
name: String,
initial_value: Value,
value_forwarder: Option<Box<ValueForwarder>>,
metadata: Option<Map<String, Value>>
) -> BaseProperty
[src]
pub fn new(
name: String,
initial_value: Value,
value_forwarder: Option<Box<ValueForwarder>>,
metadata: Option<Map<String, Value>>
) -> BaseProperty
Create a new BaseProperty.
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]
impl Property for BaseProperty
fn set_href_prefix(&mut self, prefix: String)
[src]
fn set_href_prefix(&mut self, prefix: String)
Set the prefix of any hrefs associated with this property.
prefix -- the prefix
fn get_href(&self) -> String
[src]
fn get_href(&self) -> String
Get the href of this property.
fn get_value(&self) -> Value
[src]
fn get_value(&self) -> Value
Get the current property value.
fn set_value(&mut self, value: Value) -> Result<(), &'static str>
[src]
fn set_value(&mut self, value: Value) -> Result<(), &'static str>
Set the current value of the property.
value -- the value to set
fn set_cached_value(&mut self, value: Value) -> Result<(), &'static str>
[src]
fn set_cached_value(&mut self, value: Value) -> Result<(), &'static str>
Set the cached value of the property.
value -- the value to set
fn get_name(&self) -> String
[src]
fn get_name(&self) -> String
Get the name of this property.
fn get_metadata(&self) -> Map<String, Value>
[src]
fn get_metadata(&self) -> Map<String, Value>
Get the metadata associated with this property.
fn validate_value(&self, value: &Value) -> Result<(), &'static str>
[src]
fn validate_value(&self, value: &Value) -> Result<(), &'static str>
Determine whether or not the property is read-only. Read more
fn as_property_description(&self) -> Map<String, Value>
[src]
fn as_property_description(&self) -> Map<String, Value>
Get the property description. Read more
Auto Trait Implementations
impl Send for BaseProperty
impl Send for BaseProperty
impl Sync for BaseProperty
impl Sync for BaseProperty