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
impl ObjectId
pub fn is_null(&self) -> bool
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
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 same_client_as(&self, other: &ObjectId) -> bool
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
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
.
Trait Implementations§
Source§impl Borrow<ObjectId> for WlCallback
impl Borrow<ObjectId> for WlCallback
Source§impl Borrow<ObjectId> for WlCompositor
impl Borrow<ObjectId> for WlCompositor
Source§impl Borrow<ObjectId> for WlDataDevice
impl Borrow<ObjectId> for WlDataDevice
Source§impl Borrow<ObjectId> for WlDataDeviceManager
impl Borrow<ObjectId> for WlDataDeviceManager
Source§impl Borrow<ObjectId> for WlDataOffer
impl Borrow<ObjectId> for WlDataOffer
Source§impl Borrow<ObjectId> for WlDataSource
impl Borrow<ObjectId> for WlDataSource
Source§impl Borrow<ObjectId> for WlKeyboard
impl Borrow<ObjectId> for WlKeyboard
Source§impl Borrow<ObjectId> for WlShellSurface
impl Borrow<ObjectId> for WlShellSurface
Source§impl Borrow<ObjectId> for WlSubcompositor
impl Borrow<ObjectId> for WlSubcompositor
Source§impl Borrow<ObjectId> for WlSubsurface
impl Borrow<ObjectId> for WlSubsurface
impl Eq for ObjectId
impl StructuralPartialEq for ObjectId
Auto Trait Implementations§
impl Freeze for ObjectId
impl RefUnwindSafe for ObjectId
impl Send for ObjectId
impl Sync for ObjectId
impl Unpin for ObjectId
impl UnwindSafe for ObjectId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.