Trait wayland_server::Resource [] [src]

pub trait Resource {
    fn ptr(&self) -> *mut wl_resource;
    unsafe fn from_ptr_new(*mut wl_resource) -> Self;
    unsafe fn from_ptr_initialized(*mut wl_resource) -> Self;
    fn interface_ptr() -> *const wl_interface;
    fn interface_name() -> &'static str;
    fn supported_version() -> u32;
    fn version(&self) -> i32;
    fn is_alive(&self) -> bool;
    fn equals(&self, &Self) -> bool;
}

Common routines for wayland resource objects.

All wayland objects automatically implement this trait as generated by the scanner.

It is mostly used for internal use by the library, and you should only need these methods for interfacing with C library working on wayland objects.

Required Methods

Pointer to the underlying wayland proxy object

Create an instance from a wayland pointer

The pointer must refer to a valid wayland resource of the appropriate interface, but that have not yet been seen by the library.

The library will take control of the object (notably overwrite its user_data).

Create an instance from a wayland pointer

The pointer must refer to a valid wayland resource of the appropriate interface, and have already been initialized by the library (it'll assume this proxy user_data contains a certain kind of data).

Pointer to the interface representation

Internal wayland name of this interface

Max version of this interface supported

Current version of the interface this resource is instanciated with

Check if the resource behind this handle is actually still alive

Check of two handles are actually the same wayland object

Returns false if any of the objects has already been destroyed

Implementors