ObjectRef

Enum ObjectRef 

Source
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§

§

Null

§

Owned

Fields

§name: UniqueName<'static>
§path: ObjectPath<'static>
§

Borrowed

Fields

§name: UniqueName<'o>
§path: ObjectPath<'o>

Implementations§

Source§

impl<'o> ObjectRef<'o>

Source

pub fn new(name: UniqueName<'o>, path: ObjectPath<'o>) -> Self

Create a new ObjectRef::Borrowed from a UniqueName and ObjectPath.

Source

pub fn new_owned<N, P>(name: N, path: P) -> ObjectRefOwned
where N: Into<UniqueName<'static>>, P: Into<ObjectPath<'static>>,

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);
Source

pub fn new_borrowed<N, P>(name: N, path: P) -> ObjectRef<'o>
where N: Into<UniqueName<'o>>, P: Into<ObjectPath<'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);
Source

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.

Source

pub const fn from_static_str_unchecked( name: &'static str, path: &'static str, ) -> Self

Create a new ObjectRef, unchecked.

§Safety

The caller must ensure that the strings are valid.

Source

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.

Source

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");
Source

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");
Source

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 { .. }));
Source

pub fn name_as_str(&self) -> Option<&str>

Returns the name of the object reference as a string slice.

Source

pub fn path_as_str(&self) -> &str

Returns the path of the object reference as a string slice.

Trait Implementations§

Source§

impl<'o> Clone for ObjectRef<'o>

Source§

fn clone(&self) -> ObjectRef<'o>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'o> Debug for ObjectRef<'o>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ObjectRef<'_>

Source§

fn default() -> Self

Returns a Null object reference.

Source§

impl<'de: 'o, 'o> Deserialize<'de> for ObjectRef<'o>

Source§

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>

Source§

fn from(obj: &'reference ObjectRef<'object>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for ActivateEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for ApplicationChangedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for AttributesChangedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for AttributesChangedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for BoundsChangedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for CharWidthChangedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for CloseEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for ColumnCountChangedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for ColumnDeletedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for ColumnInsertedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for ColumnReorderedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for ContentChangedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for CreateEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for DeactivateEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for DesktopCreateEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for DesktopDestroyEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for DestroyEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for FocusEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for LineChangedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for LineCountChangedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for LinkSelectedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for LoadCompleteEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for LoadStoppedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for LowerEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for MaximizeEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for MinimizeEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for ModelChangedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for MoveEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for ObjectRefOwned

Source§

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

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for RaiseEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for ReloadEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for ReparentEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for ResizeEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for RestoreEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for RestyleEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for RowDeletedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for RowInsertedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for RowReorderedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for SelectionChangedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for ShadeEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for TextAttributesChangedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for TextBoundsChangedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for TextSelectionChangedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for UUshadeEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl From<ObjectRef<'_>> for VisibleDataChangedEvent

Source§

fn from(obj_ref: ObjectRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl<'o> From<ObjectRef<'o>> for Structure<'o>

Source§

fn from(obj: ObjectRef<'o>) -> Self

Converts to this type from the input type.
Source§

impl Hash for ObjectRef<'_>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a> MessageConversionExt<'a, ObjectRef<'a>> for AvailableEvent

Source§

fn try_from_message(msg: &Message, hdr: &Header<'_>) -> Result<Self, AtspiError>

Convert a zbus::Message into this event type. Does all the validation for you. Read more
Source§

fn validate_interface(header: &Header<'_>) -> Result<(), AtspiError>

Validate the interface string via zbus::message::Header::interface against Self’s assignment of DBusInterface::DBUS_INTERFACE Read more
Source§

fn validate_member(hdr: &Header<'_>) -> Result<(), AtspiError>

Validate the member string via zbus::message::Header::member against Self’s assignment of DBusMember::DBUS_MEMBER Read more
Source§

fn validate_body(msg: &Message) -> Result<(), AtspiError>

Validate the body signature against the zvariant::Signature of MessageConversion::Body Read more
Source§

impl PartialEq<ObjectRef<'_>> for ObjectRefOwned

Source§

fn eq(&self, other: &ObjectRef<'_>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<ObjectRefOwned> for ObjectRef<'_>

Source§

fn eq(&self, other: &ObjectRefOwned) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for ObjectRef<'_>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ObjectRef<'_>

Source§

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>

Source§

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.

Source§

type Error = AtspiError

The type returned in the event of a conversion error.
Source§

impl TryFrom<OwnedValue> for ObjectRef<'static>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: OwnedValue) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'v> TryFrom<Value<'v>> for ObjectRef<'v>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: Value<'v>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'o> Type for ObjectRef<'o>

Source§

const SIGNATURE: &'static Signature

The signature for the implementing type, in parsed format. Read more
Source§

impl<'o> Eq for ObjectRef<'o>

Auto Trait Implementations§

§

impl<'o> Freeze for ObjectRef<'o>

§

impl<'o> RefUnwindSafe for ObjectRef<'o>

§

impl<'o> Send for ObjectRef<'o>

§

impl<'o> Sync for ObjectRef<'o>

§

impl<'o> Unpin for ObjectRef<'o>

§

impl<'o> UnwindSafe for ObjectRef<'o>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<'de, T> DynamicDeserialize<'de> for T
where T: Type + Deserialize<'de>,

Source§

type Deserializer = PhantomData<T>

A DeserializeSeed implementation for this type.
Source§

fn deserializer_for_signature( signature: &Signature, ) -> Result<<T as DynamicDeserialize<'de>>::Deserializer, Error>

Get a deserializer compatible with this parsed signature.
Source§

impl<T> DynamicType for T
where T: Type + ?Sized,

Source§

fn signature(&self) -> Signature

The type signature for self. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,