ObjectRefOwned

Struct ObjectRefOwned 

Source
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

Source

pub const fn new(object_ref: ObjectRef<'static>) -> Self

Create a new ObjectRefOwned from an ObjectRef<'static>.

Source

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.

Source

pub fn is_null(&self) -> bool

Returns true if the object reference is Null, otherwise returns false.

Source

pub fn into_inner(self) -> ObjectRef<'static>

Returns the inner ObjectRef, consuming self.

Source

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

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");
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 Clone for ObjectRefOwned

Source§

fn clone(&self) -> ObjectRefOwned

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 Debug for ObjectRefOwned

Source§

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

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

impl Default for ObjectRefOwned

Source§

fn default() -> ObjectRefOwned

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ObjectRefOwned

Source§

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

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<ObjectRefOwned> for Structure<'_>

Source§

fn from(obj: ObjectRefOwned) -> Self

Converts to this type from the input type.
Source§

impl Hash for ObjectRefOwned

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, ObjectRefOwned> for RemoveAccessibleEvent

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 ObjectRefOwned

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 ObjectRefOwned

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

ObjectRefOwned is serialized as the inner ObjectRef.

Source§

impl<'m> TryFrom<&'m Header<'_>> for ObjectRefOwned

Source§

fn try_from(header: &'m Header<'_>) -> Result<Self, Self::Error>

Construct an ObjectRefOwned from a zbus::message::Header.

Source§

type Error = AtspiError

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

impl TryFrom<OwnedValue> for ObjectRefOwned

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 ObjectRefOwned

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 Type for ObjectRefOwned

Source§

const SIGNATURE: &'static Signature = <ObjectRef<'static> as ::zvariant::Type>::SIGNATURE

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

impl Eq for ObjectRefOwned

Auto Trait Implementations§

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>,