Function omnisensor::dbus_helpers::props::prop_get_optional_from
source · [−]pub fn prop_get_optional_from<'a, I, T>(
map: &'a PropMap,
key: &str
) -> Result<Option<T>, Box<dyn Error>>where
T: TryFrom<&'a I, Error = Box<dyn Error>>,
I: 'static,Expand description
Like prop_get_optional(), but converts to a more specific type T via an
intermediate type I using TryFrom.
For example, an enum represented on dbus as a string can be easily converted
to its internal representation as long as the internal enum implements
TryFrom<&String>. (I is most often String, but does not have to be.)