pub enum ObjectRef<'o> {
Null,
Owned {
name: UniqueName<'static>,
path: ObjectPath<'static>,
},
Borrowed {
name: UniqueName<'o>,
path: ObjectPath<'o>,
},
}Expand description
A unique identifier for an object in the accessibility tree.
A ubiquitous type used to refer to an object in the accessibility tree.
In AT-SPI2, objects in the applications’ UI object tree are uniquely identified using an application’s bus name and object path. “(so)”
Emitted by RemoveAccessible and Available
Variants§
Implementations§
Source§impl<'o> ObjectRef<'o>
impl<'o> ObjectRef<'o>
Sourcepub fn new(name: UniqueName<'o>, path: ObjectPath<'o>) -> ObjectRef<'o>
pub fn new(name: UniqueName<'o>, path: ObjectPath<'o>) -> ObjectRef<'o>
Create a new ObjectRef::Borrowed from a UniqueName and ObjectPath.
Sourcepub fn new_owned<N, P>(name: N, path: P) -> ObjectRefOwned
pub fn new_owned<N, P>(name: N, path: P) -> ObjectRefOwned
Create a new, owned ObjectRef.
§Example
use zbus::names::UniqueName;
use zbus::zvariant::ObjectPath;
use atspi_common::ObjectRef;
let name = UniqueName::from_static_str_unchecked(":1.23");
let path = ObjectPath::from_static_str_unchecked("/org/a11y/example/path/007");
let object_ref = ObjectRef::new_owned(name, path);Sourcepub fn new_borrowed<N, P>(name: N, path: P) -> ObjectRef<'o>
pub fn new_borrowed<N, P>(name: N, path: P) -> ObjectRef<'o>
Create a new, borrowed ObjectRef.
§Example
use zbus::names::UniqueName;
use zbus::zvariant::ObjectPath;
use atspi_common::ObjectRef;
let name = UniqueName::from_static_str_unchecked(":1.23");
let path = ObjectPath::from_static_str_unchecked("/org/a11y/example/path/007");
let object_ref = ObjectRef::new_borrowed(name, path);Sourcepub fn try_from_bus_name_and_path(
sender: BusName<'o>,
path: ObjectPath<'o>,
) -> Result<ObjectRef<'o>, AtspiError>
pub fn try_from_bus_name_and_path( sender: BusName<'o>, path: ObjectPath<'o>, ) -> Result<ObjectRef<'o>, AtspiError>
Create a new ObjectRef, from BusName and ObjectPath.
§Errors
Will fail if the sender is not a UniqueName.
Sourcepub const fn from_static_str_unchecked(
name: &'static str,
path: &'static str,
) -> ObjectRef<'o>
pub const fn from_static_str_unchecked( name: &'static str, path: &'static str, ) -> ObjectRef<'o>
Sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Returns true if the object reference is Null, otherwise returns false.
Toolkits may use the Null object reference to indicate that an object is not available or does not exist.
For example, when calling Accessible::get_parent on an object that has no parent,
it may return a Null object reference.
Sourcepub fn name(&self) -> Option<&UniqueName<'o>>
pub fn name(&self) -> Option<&UniqueName<'o>>
Returns the name of the object reference.
If the object reference is Null, it returns None.
If the object reference is Owned or Borrowed, it returns the name.
§Example
use zbus::names::UniqueName;
use zbus::zvariant::ObjectPath;
use atspi_common::ObjectRef;
let name = UniqueName::from_static_str_unchecked(":1.23");
let path = ObjectPath::from_static_str_unchecked("/org/a11y/example/path/007");
let object_ref = ObjectRef::new_borrowed(name, path);
// Check the name of the object reference
assert!(object_ref.name().is_some());
assert_eq!(object_ref.name().unwrap().as_str(), ":1.23");Sourcepub fn path(&self) -> &ObjectPath<'o>
pub fn path(&self) -> &ObjectPath<'o>
Returns the path of the object reference.\
§Example
use zbus::names::UniqueName;
use zbus::zvariant::ObjectPath;
use atspi_common::ObjectRef;
let name = UniqueName::from_static_str_unchecked(":1.23");
let path = ObjectPath::from_static_str_unchecked("/org/a11y/example/path/007");
let object_ref = ObjectRef::new_borrowed(name, path);
// Check the path of the object reference
assert_eq!(object_ref.path().as_str(), "/org/a11y/example/path/007");Sourcepub fn into_owned(self) -> ObjectRef<'static>
pub fn into_owned(self) -> ObjectRef<'static>
Converts the ObjectRef into an owned instance, consuming self.
If the object reference is Null, it returns ObjectRef::Null.
If the object reference is Owned, it returns the same ObjectRef::Owned.
If the object reference is Borrowed, it converts the name and path to owned versions and returns ObjectRef::Owned.
§Extending lifetime ‘magic’ (from ’o -> ‘static’)
ObjectRef<'_> leans on the implementation of UniqueName and ObjectPath to
convert the inner types to 'static.
These types have an Inner enum that can contain an Owned, Borrowed, or Static Str type.
The Strtype is either a &'static str (static), &str (borrowed), or an Arc<str> (owned).
§Example
use zbus::names::UniqueName;
use zbus::zvariant::ObjectPath;
use atspi_common::ObjectRef;
let name = UniqueName::from_static_str_unchecked(":1.23");
let path = ObjectPath::from_static_str_unchecked("/org/a11y/example/path/007");
let object_ref = ObjectRef::new_borrowed(name, path);
// Check whether the object reference can be converted to an owned version
assert!(!object_ref.is_null());
let object_ref = object_ref.into_owned();
assert!(matches!(object_ref, ObjectRef::Owned { .. }));Sourcepub fn name_as_str(&self) -> Option<&str>
pub fn name_as_str(&self) -> Option<&str>
Returns the name of the object reference as a string slice.
Sourcepub fn path_as_str(&self) -> &str
pub fn path_as_str(&self) -> &str
Returns the path of the object reference as a string slice.
Trait Implementations§
Source§impl<'de, 'o> Deserialize<'de> for ObjectRef<'o>where
'de: 'o,
impl<'de, 'o> Deserialize<'de> for ObjectRef<'o>where
'de: 'o,
Source§fn deserialize<D>(
deserializer: D,
) -> Result<ObjectRef<'o>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<ObjectRef<'o>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
ObjectRef’s wire format is (&str, ObjectPath).
An empty &str with a “/org/a11y/atspi/null” path is considered a Null object,
this is deserialized as ObjectRef::Null.
Any other valid (&str, ObjectPath) will deserialize into ObjectRef::Borrowed.
Source§impl From<ObjectRef<'_>> for ActivateEvent
impl From<ObjectRef<'_>> for ActivateEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> ActivateEvent
fn from(obj_ref: ObjectRef<'_>) -> ActivateEvent
Source§impl From<ObjectRef<'_>> for ApplicationChangedEvent
impl From<ObjectRef<'_>> for ApplicationChangedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> ApplicationChangedEvent
fn from(obj_ref: ObjectRef<'_>) -> ApplicationChangedEvent
Source§impl From<ObjectRef<'_>> for AttributesChangedEvent
impl From<ObjectRef<'_>> for AttributesChangedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> AttributesChangedEvent
fn from(obj_ref: ObjectRef<'_>) -> AttributesChangedEvent
Source§impl From<ObjectRef<'_>> for AttributesChangedEvent
impl From<ObjectRef<'_>> for AttributesChangedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> AttributesChangedEvent
fn from(obj_ref: ObjectRef<'_>) -> AttributesChangedEvent
Source§impl From<ObjectRef<'_>> for BoundsChangedEvent
impl From<ObjectRef<'_>> for BoundsChangedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> BoundsChangedEvent
fn from(obj_ref: ObjectRef<'_>) -> BoundsChangedEvent
Source§impl From<ObjectRef<'_>> for CharWidthChangedEvent
impl From<ObjectRef<'_>> for CharWidthChangedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> CharWidthChangedEvent
fn from(obj_ref: ObjectRef<'_>) -> CharWidthChangedEvent
Source§impl From<ObjectRef<'_>> for CloseEvent
impl From<ObjectRef<'_>> for CloseEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> CloseEvent
fn from(obj_ref: ObjectRef<'_>) -> CloseEvent
Source§impl From<ObjectRef<'_>> for ColumnCountChangedEvent
impl From<ObjectRef<'_>> for ColumnCountChangedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> ColumnCountChangedEvent
fn from(obj_ref: ObjectRef<'_>) -> ColumnCountChangedEvent
Source§impl From<ObjectRef<'_>> for ColumnDeletedEvent
impl From<ObjectRef<'_>> for ColumnDeletedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> ColumnDeletedEvent
fn from(obj_ref: ObjectRef<'_>) -> ColumnDeletedEvent
Source§impl From<ObjectRef<'_>> for ColumnInsertedEvent
impl From<ObjectRef<'_>> for ColumnInsertedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> ColumnInsertedEvent
fn from(obj_ref: ObjectRef<'_>) -> ColumnInsertedEvent
Source§impl From<ObjectRef<'_>> for ColumnReorderedEvent
impl From<ObjectRef<'_>> for ColumnReorderedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> ColumnReorderedEvent
fn from(obj_ref: ObjectRef<'_>) -> ColumnReorderedEvent
Source§impl From<ObjectRef<'_>> for ContentChangedEvent
impl From<ObjectRef<'_>> for ContentChangedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> ContentChangedEvent
fn from(obj_ref: ObjectRef<'_>) -> ContentChangedEvent
Source§impl From<ObjectRef<'_>> for CreateEvent
impl From<ObjectRef<'_>> for CreateEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> CreateEvent
fn from(obj_ref: ObjectRef<'_>) -> CreateEvent
Source§impl From<ObjectRef<'_>> for DeactivateEvent
impl From<ObjectRef<'_>> for DeactivateEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> DeactivateEvent
fn from(obj_ref: ObjectRef<'_>) -> DeactivateEvent
Source§impl From<ObjectRef<'_>> for DesktopCreateEvent
impl From<ObjectRef<'_>> for DesktopCreateEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> DesktopCreateEvent
fn from(obj_ref: ObjectRef<'_>) -> DesktopCreateEvent
Source§impl From<ObjectRef<'_>> for DesktopDestroyEvent
impl From<ObjectRef<'_>> for DesktopDestroyEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> DesktopDestroyEvent
fn from(obj_ref: ObjectRef<'_>) -> DesktopDestroyEvent
Source§impl From<ObjectRef<'_>> for DestroyEvent
impl From<ObjectRef<'_>> for DestroyEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> DestroyEvent
fn from(obj_ref: ObjectRef<'_>) -> DestroyEvent
Source§impl From<ObjectRef<'_>> for FocusEvent
impl From<ObjectRef<'_>> for FocusEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> FocusEvent
fn from(obj_ref: ObjectRef<'_>) -> FocusEvent
Source§impl From<ObjectRef<'_>> for LineChangedEvent
impl From<ObjectRef<'_>> for LineChangedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> LineChangedEvent
fn from(obj_ref: ObjectRef<'_>) -> LineChangedEvent
Source§impl From<ObjectRef<'_>> for LineCountChangedEvent
impl From<ObjectRef<'_>> for LineCountChangedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> LineCountChangedEvent
fn from(obj_ref: ObjectRef<'_>) -> LineCountChangedEvent
Source§impl From<ObjectRef<'_>> for LinkSelectedEvent
impl From<ObjectRef<'_>> for LinkSelectedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> LinkSelectedEvent
fn from(obj_ref: ObjectRef<'_>) -> LinkSelectedEvent
Source§impl From<ObjectRef<'_>> for LoadCompleteEvent
impl From<ObjectRef<'_>> for LoadCompleteEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> LoadCompleteEvent
fn from(obj_ref: ObjectRef<'_>) -> LoadCompleteEvent
Source§impl From<ObjectRef<'_>> for LoadStoppedEvent
impl From<ObjectRef<'_>> for LoadStoppedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> LoadStoppedEvent
fn from(obj_ref: ObjectRef<'_>) -> LoadStoppedEvent
Source§impl From<ObjectRef<'_>> for LowerEvent
impl From<ObjectRef<'_>> for LowerEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> LowerEvent
fn from(obj_ref: ObjectRef<'_>) -> LowerEvent
Source§impl From<ObjectRef<'_>> for MaximizeEvent
impl From<ObjectRef<'_>> for MaximizeEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> MaximizeEvent
fn from(obj_ref: ObjectRef<'_>) -> MaximizeEvent
Source§impl From<ObjectRef<'_>> for MinimizeEvent
impl From<ObjectRef<'_>> for MinimizeEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> MinimizeEvent
fn from(obj_ref: ObjectRef<'_>) -> MinimizeEvent
Source§impl From<ObjectRef<'_>> for ModelChangedEvent
impl From<ObjectRef<'_>> for ModelChangedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> ModelChangedEvent
fn from(obj_ref: ObjectRef<'_>) -> ModelChangedEvent
Source§impl From<ObjectRef<'_>> for ObjectRefOwned
impl From<ObjectRef<'_>> for ObjectRefOwned
Source§fn from(object_ref: ObjectRef<'_>) -> ObjectRefOwned
fn from(object_ref: ObjectRef<'_>) -> ObjectRefOwned
Convert an ObjectRef<'_> into an ObjectRefOwned.
§Extending lifetime ‘magic’ (from ’o -> ‘static’)
ObjectRef<'_> leans on the implementation of UniqueName and ObjectPath to
convert the inner types to 'static.
These types have an Inner enum that can contain an Owned, Borrowed, or Static Str type.
The Strtype is either a &'static str (static), &str (borrowed), or an Arc<str> (owned).
Source§impl From<ObjectRef<'_>> for PageChangedEvent
impl From<ObjectRef<'_>> for PageChangedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> PageChangedEvent
fn from(obj_ref: ObjectRef<'_>) -> PageChangedEvent
Source§impl From<ObjectRef<'_>> for RaiseEvent
impl From<ObjectRef<'_>> for RaiseEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> RaiseEvent
fn from(obj_ref: ObjectRef<'_>) -> RaiseEvent
Source§impl From<ObjectRef<'_>> for ReloadEvent
impl From<ObjectRef<'_>> for ReloadEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> ReloadEvent
fn from(obj_ref: ObjectRef<'_>) -> ReloadEvent
Source§impl From<ObjectRef<'_>> for ReparentEvent
impl From<ObjectRef<'_>> for ReparentEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> ReparentEvent
fn from(obj_ref: ObjectRef<'_>) -> ReparentEvent
Source§impl From<ObjectRef<'_>> for ResizeEvent
impl From<ObjectRef<'_>> for ResizeEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> ResizeEvent
fn from(obj_ref: ObjectRef<'_>) -> ResizeEvent
Source§impl From<ObjectRef<'_>> for RestoreEvent
impl From<ObjectRef<'_>> for RestoreEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> RestoreEvent
fn from(obj_ref: ObjectRef<'_>) -> RestoreEvent
Source§impl From<ObjectRef<'_>> for RestyleEvent
impl From<ObjectRef<'_>> for RestyleEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> RestyleEvent
fn from(obj_ref: ObjectRef<'_>) -> RestyleEvent
Source§impl From<ObjectRef<'_>> for RowDeletedEvent
impl From<ObjectRef<'_>> for RowDeletedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> RowDeletedEvent
fn from(obj_ref: ObjectRef<'_>) -> RowDeletedEvent
Source§impl From<ObjectRef<'_>> for RowInsertedEvent
impl From<ObjectRef<'_>> for RowInsertedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> RowInsertedEvent
fn from(obj_ref: ObjectRef<'_>) -> RowInsertedEvent
Source§impl From<ObjectRef<'_>> for RowReorderedEvent
impl From<ObjectRef<'_>> for RowReorderedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> RowReorderedEvent
fn from(obj_ref: ObjectRef<'_>) -> RowReorderedEvent
Source§impl From<ObjectRef<'_>> for SelectionChangedEvent
impl From<ObjectRef<'_>> for SelectionChangedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> SelectionChangedEvent
fn from(obj_ref: ObjectRef<'_>) -> SelectionChangedEvent
Source§impl From<ObjectRef<'_>> for ShadeEvent
impl From<ObjectRef<'_>> for ShadeEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> ShadeEvent
fn from(obj_ref: ObjectRef<'_>) -> ShadeEvent
Source§impl From<ObjectRef<'_>> for TextAttributesChangedEvent
impl From<ObjectRef<'_>> for TextAttributesChangedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> TextAttributesChangedEvent
fn from(obj_ref: ObjectRef<'_>) -> TextAttributesChangedEvent
Source§impl From<ObjectRef<'_>> for TextBoundsChangedEvent
impl From<ObjectRef<'_>> for TextBoundsChangedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> TextBoundsChangedEvent
fn from(obj_ref: ObjectRef<'_>) -> TextBoundsChangedEvent
Source§impl From<ObjectRef<'_>> for TextSelectionChangedEvent
impl From<ObjectRef<'_>> for TextSelectionChangedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> TextSelectionChangedEvent
fn from(obj_ref: ObjectRef<'_>) -> TextSelectionChangedEvent
Source§impl From<ObjectRef<'_>> for UUshadeEvent
impl From<ObjectRef<'_>> for UUshadeEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> UUshadeEvent
fn from(obj_ref: ObjectRef<'_>) -> UUshadeEvent
Source§impl From<ObjectRef<'_>> for VisibleDataChangedEvent
impl From<ObjectRef<'_>> for VisibleDataChangedEvent
Source§fn from(obj_ref: ObjectRef<'_>) -> VisibleDataChangedEvent
fn from(obj_ref: ObjectRef<'_>) -> VisibleDataChangedEvent
Source§impl<'a> MessageConversionExt<'a, ObjectRef<'a>> for AvailableEvent
impl<'a> MessageConversionExt<'a, ObjectRef<'a>> for AvailableEvent
Source§fn try_from_message(
msg: &Message,
hdr: &Header<'_>,
) -> Result<AvailableEvent, AtspiError>
fn try_from_message( msg: &Message, hdr: &Header<'_>, ) -> Result<AvailableEvent, AtspiError>
zbus::Message into this event type.
Does all the validation for you. Read moreSource§fn validate_interface(header: &Header<'_>) -> Result<(), AtspiError>
fn validate_interface(header: &Header<'_>) -> Result<(), AtspiError>
zbus::message::Header::interface against Self’s assignment of DBusInterface::DBUS_INTERFACE Read moreSource§fn validate_member(hdr: &Header<'_>) -> Result<(), AtspiError>
fn validate_member(hdr: &Header<'_>) -> Result<(), AtspiError>
zbus::message::Header::member against Self’s assignment of DBusMember::DBUS_MEMBER Read moreSource§fn validate_body(msg: &Message) -> Result<(), AtspiError>
fn validate_body(msg: &Message) -> Result<(), AtspiError>
Source§impl PartialEq<ObjectRef<'_>> for ObjectRefOwned
impl PartialEq<ObjectRef<'_>> for ObjectRefOwned
Source§impl PartialEq<ObjectRefOwned> for ObjectRef<'_>
impl PartialEq<ObjectRefOwned> for ObjectRef<'_>
Source§impl Serialize for ObjectRef<'_>
impl Serialize for ObjectRef<'_>
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
ObjectRef’s wire format is (&str, ObjectPath).
The Null variant, the “Null object”, is serialized as ("", ObjectPath("/org/a11y/atspi/null")).
Both Owned and Borrowed variants are serialized as (&str, ObjectPath) with the object’s
unique name and path.
Source§impl<'m, 'o> TryFrom<&'m Header<'_>> for ObjectRef<'o>where
'm: 'o,
impl<'m, 'o> TryFrom<&'m Header<'_>> for ObjectRef<'o>where
'm: 'o,
Source§fn try_from(
header: &'m Header<'_>,
) -> Result<ObjectRef<'o>, <ObjectRef<'o> as TryFrom<&'m Header<'_>>>::Error>
fn try_from( header: &'m Header<'_>, ) -> Result<ObjectRef<'o>, <ObjectRef<'o> as TryFrom<&'m Header<'_>>>::Error>
Construct an ObjectRef from a zbus::message::Header.
§Header fields
Path is a mandatory field on method calls and signals,
Sender is an optional field, see:
DBus specification - header fields).,
On a message bus, this header field is controlled by the message bus,
so it is as reliable and trustworthy as the message bus itself.
Otherwise, (eg. P2P) this header field is controlled by the message sender,
unless there is out-of-band information that indicates otherwise.While unlikely, it is possible that Sender or Path are not set on the header.
This could happen if the server implementation does not set these fields for any reason.
§Errors
Will return an AtspiError::ParseError if the header does not contain a valid path or sender.