wayland_server::backend

Struct ObjectId

pub struct ObjectId { /* private fields */ }
Expand description

An ID representing a Wayland object

The backend internally tracks which IDs are still valid, invalidates them when the protocol object they represent is destroyed. As such even though the Wayland protocol reuses IDs, you still confidently compare two ObjectId for equality, they will only compare as equal if they both represent the same protocol object from the same client.

Implementations§

§

impl ObjectId

pub fn is_null(&self) -> bool

Returns whether this object is a null object.

Note: This is not the same as checking if the ID is still valid, which cannot be done without the Backend. A null ID is the ID equivalent of a null pointer: it never has been valid and never will be.

pub fn null() -> ObjectId

Returns an object id that represents a null object.

This object ID is always invalid, and should be used for events with an optional Object argument.

pub fn interface(&self) -> &'static Interface

Returns the interface of this object.

pub fn same_client_as(&self, other: &ObjectId) -> bool

Check if two object IDs are associated with the same client

Note: This may spuriously return false if one (or both) of the objects to compare is no longer valid.

pub fn protocol_id(&self) -> u32

Return the protocol-level numerical ID of this object

Protocol IDs are reused after object destruction and each client has its own ID space, so this should not be used as a unique identifier, instead use the ObjectId directly, it implements Clone, PartialEq, Eq and Hash.

§

impl ObjectId

pub unsafe fn from_ptr( interface: &'static Interface, ptr: *mut wl_resource, ) -> Result<ObjectId, InvalidId>

Available on crate feature server_system only.

Creates an object from a C pointer.

§Errors

This function returns an InvalidId error if the interface of the resource does not match the provided interface.

§Safety

The provided pointer must be a valid pointer to a wl_resource and remain valid for as long as the retrieved ObjectId is used.

pub fn as_ptr(&self) -> *mut wl_resource

Available on crate feature server_system only.

Returns the pointer that represents this object.

The pointer may be used to interoperate with libwayland.

Trait Implementations§

Source§

impl Borrow<ObjectId> for WlBuffer

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Borrow<ObjectId> for WlCallback

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Borrow<ObjectId> for WlCompositor

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Borrow<ObjectId> for WlDataDevice

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Borrow<ObjectId> for WlDataDeviceManager

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Borrow<ObjectId> for WlDataOffer

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Borrow<ObjectId> for WlDataSource

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Borrow<ObjectId> for WlKeyboard

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Borrow<ObjectId> for WlOutput

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Borrow<ObjectId> for WlPointer

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Borrow<ObjectId> for WlRegion

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Borrow<ObjectId> for WlSeat

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Borrow<ObjectId> for WlShell

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Borrow<ObjectId> for WlShellSurface

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Borrow<ObjectId> for WlShm

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Borrow<ObjectId> for WlShmPool

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Borrow<ObjectId> for WlSubcompositor

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Borrow<ObjectId> for WlSubsurface

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Borrow<ObjectId> for WlSurface

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
Source§

impl Borrow<ObjectId> for WlTouch

Source§

fn borrow(&self) -> &ObjectId

Immutably borrows from an owned value. Read more
§

impl Clone for ObjectId

§

fn clone(&self) -> ObjectId

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

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

Performs copy-assignment from source. Read more
§

impl Debug for ObjectId

§

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

Formats the value using the given formatter. Read more
§

impl Display for ObjectId

§

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

Formats the value using the given formatter. Read more
§

impl Hash for ObjectId

§

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

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
§

impl PartialEq for ObjectId

§

fn eq(&self, other: &ObjectId) -> 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.
§

impl Eq for ObjectId

§

impl StructuralPartialEq for ObjectId

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, dst: *mut u8)

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

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.