Trait atspi_common::events::GenericEvent
source · pub trait GenericEvent<'a> {
type Body: Type + Serialize + Deserialize<'a>;
const DBUS_MEMBER: &'static str;
const DBUS_INTERFACE: &'static str;
const MATCH_RULE_STRING: &'static str;
const REGISTRY_EVENT_STRING: &'static str;
// Required methods
fn build(item: Accessible, body: Self::Body) -> Result<Self, AtspiError>
where Self: Sized;
fn path(&self) -> ObjectPath<'_>;
fn sender(&self) -> String;
fn body(&self) -> Self::Body;
}
Expand description
Shared behavior of bus Signal
events.
Required Associated Types§
sourcetype Body: Type + Serialize + Deserialize<'a>
type Body: Type + Serialize + Deserialize<'a>
What is the body type of this event.
Required Associated Constants§
sourceconst DBUS_MEMBER: &'static str
const DBUS_MEMBER: &'static str
The DBus
member for the event.
For example, for an object::TextChangedEvent
this should be "TextChanged"
sourceconst DBUS_INTERFACE: &'static str
const DBUS_INTERFACE: &'static str
The DBus
interface name for this event.
For example, for any event within object
, this should be “org.a11y.atspi.Event.Object”.
sourceconst MATCH_RULE_STRING: &'static str
const MATCH_RULE_STRING: &'static str
A static match rule string for DBus
.
This should usually be a string that looks like this: "type='signal',interface='org.a11y.atspi.Event.Object',member='PropertyChange'"
;
This should be deprecated in favour of composing the string from Self::DBUS_MEMBER
and Self::DBUS_INTERFACE
.
sourceconst REGISTRY_EVENT_STRING: &'static str
const REGISTRY_EVENT_STRING: &'static str
A registry event string for registering for event receiving via the RegistryProxy
.
This should be deprecated in favour of composing the string from Self::DBUS_MEMBER
and Self::DBUS_INTERFACE
.
Required Methods§
sourcefn build(item: Accessible, body: Self::Body) -> Result<Self, AtspiError>where
Self: Sized,
fn build(item: Accessible, body: Self::Body) -> Result<Self, AtspiError>where Self: Sized,
Build the event from the object pair (Accessible and the Body).
Errors
When the body type, which is what the raw message looks like over DBus
, does not match the type that is expected for the given event.
It is not possible for this to error on most events, but on events whose raw message Self::Body
type contains a zvariant::Value
, you may get errors when constructing the structure.
sourcefn path(&self) -> ObjectPath<'_>
fn path(&self) -> ObjectPath<'_>
Path of the signalling object.