pub struct ObjectRefOwned(/* private fields */);Expand description
A wrapper around the static variant of ObjectRef.
This is guaranteed to have a 'static lifetime.
Implementations§
Source§impl ObjectRefOwned
impl ObjectRefOwned
Sourcepub const fn new(object_ref: ObjectRef<'static>) -> Self
pub const fn new(object_ref: ObjectRef<'static>) -> Self
Create a new ObjectRefOwned from an ObjectRef<'static>.
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
Create a new ObjectRefOwned from &'static str unchecked.
§Safety
The caller must ensure that the strings are valid.
Sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Returns true if the object reference is Null, otherwise returns false.
Sourcepub fn into_inner(self) -> ObjectRef<'static>
pub fn into_inner(self) -> ObjectRef<'static>
Returns the inner ObjectRef, consuming self.
Sourcepub fn name(&self) -> Option<&UniqueName<'static>>
pub fn name(&self) -> Option<&UniqueName<'static>>
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_as_str().unwrap(), ":1.23");Sourcepub fn path(&self) -> &ObjectPath<'static>
pub fn path(&self) -> &ObjectPath<'static>
Returns the path of the object reference.
If the object reference is Null, it returns the null-path.
§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);
assert_eq!(object_ref.path_as_str(), "/org/a11y/example/path/007");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 Clone for ObjectRefOwned
impl Clone for ObjectRefOwned
Source§fn clone(&self) -> ObjectRefOwned
fn clone(&self) -> ObjectRefOwned
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ObjectRefOwned
impl Debug for ObjectRefOwned
Source§impl Default for ObjectRefOwned
impl Default for ObjectRefOwned
Source§fn default() -> ObjectRefOwned
fn default() -> ObjectRefOwned
Source§impl<'de> Deserialize<'de> for ObjectRefOwned
impl<'de> Deserialize<'de> for ObjectRefOwned
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>,
ObjectRefOwned is deserialized as “Owned” variant ObjectRef<'static>.
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<ObjectRefOwned> for Structure<'_>
impl From<ObjectRefOwned> for Structure<'_>
Source§fn from(obj: ObjectRefOwned) -> Self
fn from(obj: ObjectRefOwned) -> Self
Source§impl Hash for ObjectRefOwned
impl Hash for ObjectRefOwned
Source§impl<'a> MessageConversionExt<'a, ObjectRefOwned> for RemoveAccessibleEvent
impl<'a> MessageConversionExt<'a, ObjectRefOwned> for RemoveAccessibleEvent
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 more