[−][src]Struct webthing::property::BaseProperty
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]
pub fn new(
name: String,
initial_value: Value,
value_forwarder: Option<Box<dyn ValueForwarder>>,
metadata: Option<Map<String, Value>>
) -> BaseProperty
[src]
name: String,
initial_value: Value,
value_forwarder: Option<Box<dyn 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]
fn set_href_prefix(&mut self, prefix: String)
[src]
Set the prefix of any hrefs associated with this property.
prefix -- the prefix
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.
value -- the value to set
fn set_cached_value(&mut self, value: Value) -> Result<(), &'static str>
[src]
Set the cached value of the property.
value -- the value to set
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.
fn validate_value(&self, value: &Value) -> Result<(), &'static str>
[src]
Validate new property value before setting it. Read more
fn as_property_description(&self) -> Map<String, Value>
[src]
Get the property description. Read more
Auto Trait Implementations
impl Unpin for BaseProperty
impl Sync for BaseProperty
impl Send for BaseProperty
impl !RefUnwindSafe for BaseProperty
impl !UnwindSafe for BaseProperty
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Erased for T
impl<T> GetTypeId for T where
T: Any,
[src]
T: Any,