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 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.
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.
Sourcepub fn display_ptr(&self) -> Result<NonNull<wl_display>, InvalidId>
pub fn display_ptr(&self) -> Result<NonNull<wl_display>, InvalidId>
Get the underlying display pointer for this object.
This pointer is associated with the original display this object belongs to.