pub trait MessageConversionExt<B>: MessageConversion<Body = B>{
// Required method
fn try_from_message(msg: &Message) -> Result<Self, AtspiError>
where Self: Sized;
// Provided methods
fn validate_interface(msg: &Message) -> Result<(), AtspiError> { ... }
fn validate_member(msg: &Message) -> Result<(), AtspiError> { ... }
fn validate_body(msg: &Message) -> Result<(), AtspiError> { ... }
}
Required Methods§
Sourcefn try_from_message(msg: &Message) -> Result<Self, AtspiError>where
Self: Sized,
fn try_from_message(msg: &Message) -> Result<Self, AtspiError>where
Self: Sized,
Convert a zbus::Message
into this event type.
Does all the validation for you.
§Errors
- The message does not have an interface:
AtspiError::MissingInterface
- The message interface does not match the one for the event:
AtspiError::InterfaceMatch
- The message does not have an member:
AtspiError::MissingMember
- The message member does not match the one for the event:
AtspiError::MemberMatch
- The message signature does not match the one for the event:
AtspiError::SignatureMatch
See MessageConversion::from_message_unchecked
for info on panic condition that should never
happen.
Provided Methods§
Sourcefn validate_interface(msg: &Message) -> Result<(), AtspiError>
fn validate_interface(msg: &Message) -> Result<(), AtspiError>
Validate the interface string via zbus::message::Header::interface
against Self
’s assignment of BusProperties::DBUS_INTERFACE
§Errors
AtspiError::MissingInterface
if there is no interfaceAtspiError::InterfaceMatch
if the interfaces do not match
Sourcefn validate_member(msg: &Message) -> Result<(), AtspiError>
fn validate_member(msg: &Message) -> Result<(), AtspiError>
Validate the member string via zbus::message::Header::member
against Self
’s assignment of BusProperties::DBUS_MEMBER
§Errors
AtspiError::MissingMember
if there is no memberAtspiError::MemberMatch
if the members do not match
Sourcefn validate_body(msg: &Message) -> Result<(), AtspiError>
fn validate_body(msg: &Message) -> Result<(), AtspiError>
Validate the body signature against the zvariant::Signature
of MessageConversion::Body
§Errors
AtspiError::SignatureMatch
if the signatures do not match
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.