pub struct Feature {
pub definition: Vec<DefinitionIdentifier>,
pub properties: BTreeMap<PropertyId, Value>,
pub desired_properties: BTreeMap<PropertyId, Value>,
}Expand description
A Feature — a named, typed bag of properties on a Thing.
properties is the reported state (what the device says it is);
desired_properties is the cloud-driven target state — twin pattern.
Fields§
§definition: Vec<DefinitionIdentifier>Definitions implemented by this feature, in priority order.
properties: BTreeMap<PropertyId, Value>Reported state.
desired_properties: BTreeMap<PropertyId, Value>Desired state (target).
Implementations§
Source§impl Feature
impl Feature
Sourcepub fn with_property(self, id: PropertyId, value: Value) -> Self
pub fn with_property(self, id: PropertyId, value: Value) -> Self
Set or overwrite a reported property.
Sourcepub fn property(&self, id: &PropertyId) -> Option<&Value>
pub fn property(&self, id: &PropertyId) -> Option<&Value>
Look up a reported property.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Feature
impl<'de> Deserialize<'de> for Feature
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Feature
Auto Trait Implementations§
impl Freeze for Feature
impl RefUnwindSafe for Feature
impl Send for Feature
impl Sync for Feature
impl Unpin for Feature
impl UnsafeUnpin for Feature
impl UnwindSafe for Feature
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more