pub struct PropSet {
values: HashMap<u32, Result<Vec<u8>, Status>>,
}Expand description
Properties fetched together, each either answered or refused.
A refusal is an answer: an OPTIONAL property a device does not implement refuses the read, and over the mesh the unreachable half of the property space refuses every position. Both mean “absent”, which is why the accessors collapse them.
An empty value is not absent. Several properties spell “no fix”,
“no threshold”, or “never tag” as zero octets, so Self::bytes
hands back an empty slice rather than None when the device answered
with one.
Fields§
§values: HashMap<u32, Result<Vec<u8>, Status>>Implementations§
Source§impl PropSet
impl PropSet
pub fn new() -> Self
pub fn insert(&mut self, key: u32, answer: Result<Vec<u8>, Status>)
Sourcepub fn bytes(&self, key: u32) -> Option<&[u8]>
pub fn bytes(&self, key: u32) -> Option<&[u8]>
The octets the device answered with, if it answered.
Sourcepub fn non_empty(&self, key: u32) -> Option<&[u8]>
pub fn non_empty(&self, key: u32) -> Option<&[u8]>
The octets, treating an empty answer as no answer.
For the properties where empty is the device saying it has nothing rather than saying zero.
Sourcepub fn refusal(&self, key: u32) -> Option<Status>
pub fn refusal(&self, key: u32) -> Option<Status>
The status a refused property came back with.
pub fn bool(&self, key: u32) -> Option<bool>
pub fn u8(&self, key: u32) -> Option<u8>
pub fn i8(&self, key: u32) -> Option<i8>
pub fn u16(&self, key: u32) -> Option<u16>
pub fn i16(&self, key: u32) -> Option<i16>
pub fn u32(&self, key: u32) -> Option<u32>
pub fn i32(&self, key: u32) -> Option<i32>
Sourcepub fn text(&self, key: u32) -> Option<String>
pub fn text(&self, key: u32) -> Option<String>
A STRING property, without the NUL the wire carries.