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>) -> Self
 
pub fn new(name: UniqueName<'o>, path: ObjectPath<'o>) -> Self
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<Self, AtspiError>
 
pub fn try_from_bus_name_and_path( sender: BusName<'o>, path: ObjectPath<'o>, ) -> Result<Self, 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,
) -> Self
 
pub const fn from_static_str_unchecked( name: &'static str, path: &'static str, ) -> Self
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, 'o> Deserialize<'de> for ObjectRef<'o>
 
impl<'de: 'o, 'o> Deserialize<'de> for ObjectRef<'o>
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
    D: Deserializer<'de>,
 
fn deserialize<D>(deserializer: D) -> Result<Self, D::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<'reference: 'structure, 'object: 'structure, 'structure> From<&'reference ObjectRef<'object>> for Structure<'structure>
 
impl<'reference: 'structure, 'object: 'structure, 'structure> From<&'reference ObjectRef<'object>> for Structure<'structure>
Source§impl From<ObjectRef<'_>> for ActivateEvent
 
impl From<ObjectRef<'_>> for ActivateEvent
Source§impl From<ObjectRef<'_>> for ApplicationChangedEvent
 
impl From<ObjectRef<'_>> for ApplicationChangedEvent
Source§impl From<ObjectRef<'_>> for AttributesChangedEvent
 
impl From<ObjectRef<'_>> for AttributesChangedEvent
Source§impl From<ObjectRef<'_>> for AttributesChangedEvent
 
impl From<ObjectRef<'_>> for AttributesChangedEvent
Source§impl From<ObjectRef<'_>> for BoundsChangedEvent
 
impl From<ObjectRef<'_>> for BoundsChangedEvent
Source§impl From<ObjectRef<'_>> for CharWidthChangedEvent
 
impl From<ObjectRef<'_>> for CharWidthChangedEvent
Source§impl From<ObjectRef<'_>> for CloseEvent
 
impl From<ObjectRef<'_>> for CloseEvent
Source§impl From<ObjectRef<'_>> for ColumnCountChangedEvent
 
impl From<ObjectRef<'_>> for ColumnCountChangedEvent
Source§impl From<ObjectRef<'_>> for ColumnDeletedEvent
 
impl From<ObjectRef<'_>> for ColumnDeletedEvent
Source§impl From<ObjectRef<'_>> for ColumnInsertedEvent
 
impl From<ObjectRef<'_>> for ColumnInsertedEvent
Source§impl From<ObjectRef<'_>> for ColumnReorderedEvent
 
impl From<ObjectRef<'_>> for ColumnReorderedEvent
Source§impl From<ObjectRef<'_>> for ContentChangedEvent
 
impl From<ObjectRef<'_>> for ContentChangedEvent
Source§impl From<ObjectRef<'_>> for CreateEvent
 
impl From<ObjectRef<'_>> for CreateEvent
Source§impl From<ObjectRef<'_>> for DeactivateEvent
 
impl From<ObjectRef<'_>> for DeactivateEvent
Source§impl From<ObjectRef<'_>> for DesktopCreateEvent
 
impl From<ObjectRef<'_>> for DesktopCreateEvent
Source§impl From<ObjectRef<'_>> for DesktopDestroyEvent
 
impl From<ObjectRef<'_>> for DesktopDestroyEvent
Source§impl From<ObjectRef<'_>> for DestroyEvent
 
impl From<ObjectRef<'_>> for DestroyEvent
Source§impl From<ObjectRef<'_>> for FocusEvent
 
impl From<ObjectRef<'_>> for FocusEvent
Source§impl From<ObjectRef<'_>> for LineChangedEvent
 
impl From<ObjectRef<'_>> for LineChangedEvent
Source§impl From<ObjectRef<'_>> for LineCountChangedEvent
 
impl From<ObjectRef<'_>> for LineCountChangedEvent
Source§impl From<ObjectRef<'_>> for LinkSelectedEvent
 
impl From<ObjectRef<'_>> for LinkSelectedEvent
Source§impl From<ObjectRef<'_>> for LoadCompleteEvent
 
impl From<ObjectRef<'_>> for LoadCompleteEvent
Source§impl From<ObjectRef<'_>> for LoadStoppedEvent
 
impl From<ObjectRef<'_>> for LoadStoppedEvent
Source§impl From<ObjectRef<'_>> for LowerEvent
 
impl From<ObjectRef<'_>> for LowerEvent
Source§impl From<ObjectRef<'_>> for MaximizeEvent
 
impl From<ObjectRef<'_>> for MaximizeEvent
Source§impl From<ObjectRef<'_>> for MinimizeEvent
 
impl From<ObjectRef<'_>> for MinimizeEvent
Source§impl From<ObjectRef<'_>> for ModelChangedEvent
 
impl From<ObjectRef<'_>> for ModelChangedEvent
Source§impl From<ObjectRef<'_>> for ObjectRefOwned
 
impl From<ObjectRef<'_>> for ObjectRefOwned
Source§fn from(object_ref: ObjectRef<'_>) -> Self
 
fn from(object_ref: ObjectRef<'_>) -> Self
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§impl From<ObjectRef<'_>> for RaiseEvent
 
impl From<ObjectRef<'_>> for RaiseEvent
Source§impl From<ObjectRef<'_>> for ReloadEvent
 
impl From<ObjectRef<'_>> for ReloadEvent
Source§impl From<ObjectRef<'_>> for ReparentEvent
 
impl From<ObjectRef<'_>> for ReparentEvent
Source§impl From<ObjectRef<'_>> for ResizeEvent
 
impl From<ObjectRef<'_>> for ResizeEvent
Source§impl From<ObjectRef<'_>> for RestoreEvent
 
impl From<ObjectRef<'_>> for RestoreEvent
Source§impl From<ObjectRef<'_>> for RestyleEvent
 
impl From<ObjectRef<'_>> for RestyleEvent
Source§impl From<ObjectRef<'_>> for RowDeletedEvent
 
impl From<ObjectRef<'_>> for RowDeletedEvent
Source§impl From<ObjectRef<'_>> for RowInsertedEvent
 
impl From<ObjectRef<'_>> for RowInsertedEvent
Source§impl From<ObjectRef<'_>> for RowReorderedEvent
 
impl From<ObjectRef<'_>> for RowReorderedEvent
Source§impl From<ObjectRef<'_>> for SelectionChangedEvent
 
impl From<ObjectRef<'_>> for SelectionChangedEvent
Source§impl From<ObjectRef<'_>> for ShadeEvent
 
impl From<ObjectRef<'_>> for ShadeEvent
Source§impl From<ObjectRef<'_>> for TextAttributesChangedEvent
 
impl From<ObjectRef<'_>> for TextAttributesChangedEvent
Source§impl From<ObjectRef<'_>> for TextBoundsChangedEvent
 
impl From<ObjectRef<'_>> for TextBoundsChangedEvent
Source§impl From<ObjectRef<'_>> for TextSelectionChangedEvent
 
impl From<ObjectRef<'_>> for TextSelectionChangedEvent
Source§impl From<ObjectRef<'_>> for UUshadeEvent
 
impl From<ObjectRef<'_>> for UUshadeEvent
Source§impl From<ObjectRef<'_>> for VisibleDataChangedEvent
 
impl From<ObjectRef<'_>> for 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<Self, AtspiError>
 
fn try_from_message(msg: &Message, hdr: &Header<'_>) -> Result<Self, 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::Ok, S::Error>where
    S: Serializer,
 
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::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, 'o> TryFrom<&'m Header<'_>> for ObjectRef<'o>
 
impl<'m: 'o, 'o> TryFrom<&'m Header<'_>> for ObjectRef<'o>
Source§fn try_from(header: &'m Header<'_>) -> Result<Self, Self::Error>
 
fn try_from(header: &'m Header<'_>) -> Result<Self, Self::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.