impl_tryfrommessage_for_event_wrapper

Macro impl_tryfrommessage_for_event_wrapper 

Source
macro_rules! impl_tryfrommessage_for_event_wrapper {
    ($wrapper:ty) => { ... };
}
Expand description

Implements TryFromMessage for a given event wrapper type.

§Example

impl_tryfrommessage_for_event_wrapper!(StateChangedEvent);

expands to:

#[cfg(feature = "zbus")]
impl TryFromMessage for StateChangedEvent {
    fn try_from_message(msg: &zbus::Message) -> Result<StateChangedEvent, AtspiError> {
       let header = msg.header();
       let interface = header.interface().ok_or(AtspiError::MissingInterface)?;
       if interface != Self::DBUS_INTERFACE {
           return Err(AtspiError::InterfaceMatch(format!(
               "Interface {} does not match require interface for event: {}",
               interface,
               Self::DBUS_INTERFACE
           )));
       }
       Self::try_from_message_interface_checked(msg, &header)
    }
}