Function omnisensor::dbus_helpers::props::prop_get_optional
source · [−]pub fn prop_get_optional<'a, T: 'static>(
map: &'a PropMap,
key: &str
) -> Result<Option<&'a T>, Box<dyn Error>>
Expand description
Similar to dbus::arg::prop_cast()
, but more fine-grained.
So that the caller can distinguish cases we want to default (key not present) from ones we want to flag as an error (key present but invalid), return values are as follows:
Ok(Some(_))
if the key is present and the corresponding value is valid.Ok(None)
if the key is absent.Err(_)
if the key is present but the value is not a validT
.