Struct wayland_backend::sys::client::ObjectId
source · pub struct ObjectId { /* private fields */ }
client_system
or server_system
) and crate feature client_system
only.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 can confidently compare
two ObjectId
for equality, they will only compare as equal if they both represent the same protocol
object.
Implementations§
source§impl ObjectId
impl ObjectId
sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Check if this is a null ID
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.
sourcepub fn null() -> ObjectId
pub fn null() -> ObjectId
Create a null object ID
This object ID is always invalid, and should be used as placeholder in requests that create objects,
or for request with an optional Object
argument.
See Backend::send_request
for details.
sourcepub 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, so this should not be used as a unique identifier,
instead use the ObjectId
directly, it implements Clone
, PartialEq
, Eq
and Hash
.
source§impl ObjectId
impl ObjectId
sourcepub unsafe fn from_ptr(
interface: &'static Interface,
ptr: *mut wl_proxy
) -> Result<Self, InvalidId>
pub unsafe fn from_ptr( interface: &'static Interface, ptr: *mut wl_proxy ) -> Result<Self, InvalidId>
Creates an object id from a libwayland-client pointer.
Errors
This function returns an InvalidId
error if the interface of the proxy 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.
Trait Implementations§
source§impl PartialEq<ObjectId> for ObjectId
impl PartialEq<ObjectId> for ObjectId
impl Eq for ObjectId
impl StructuralEq for ObjectId
impl StructuralPartialEq for ObjectId
Auto Trait Implementations§
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
source§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§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.source§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.