Trait wayland_client::Proxy
[−]
[src]
pub unsafe trait Proxy { fn ptr(&self) -> *mut wl_proxy; unsafe fn from_ptr_new(_: *mut wl_proxy) -> Self; unsafe fn from_ptr_initialized(_: *mut wl_proxy) -> Self; fn interface_ptr() -> *const wl_interface; fn interface_name() -> &'static str; fn supported_version() -> u32; fn version(&self) -> u32; fn status(&self) -> Liveness; fn equals(&self, _: &Self) -> bool; fn set_user_data(&self, ptr: *mut ()); fn get_user_data(&self) -> *mut (); unsafe fn clone_unchecked(&self) -> Self
where
Self: Sized; fn clone(&self) -> Option<Self>
where
Self: Sized, { ... } }
Common routines for wayland proxy 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
fn ptr(&self) -> *mut wl_proxy
Pointer to the underlying wayland proxy object
unsafe fn from_ptr_new(_: *mut wl_proxy) -> Self
Create an instance from a wayland pointer
The pointer must refer to a valid wayland proxy 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).
unsafe fn from_ptr_initialized(_: *mut wl_proxy) -> Self
Create an instance from a wayland pointer
The pointer must refer to a valid wayland proxy of the appropriate interface. The library will detect if the proxy is already managed by it or not. If it is not, this proxy will be considered as "unmanaged", and should then be handled with care.
fn interface_ptr() -> *const wl_interface
Pointer to the interface representation
fn interface_name() -> &'static str
Internal wayland name of this interface
fn supported_version() -> u32
Max version of this interface supported
fn version(&self) -> u32
Current version of the interface this proxy is instantiated with
fn status(&self) -> Liveness
Check if the proxy behind this handle is actually still alive
fn equals(&self, _: &Self) -> bool
Check of two handles are actually the same wayland object
Returns false
if any of the objects has already been destroyed
fn set_user_data(&self, ptr: *mut ())
Set a pointer associated as user data on this proxy
All proxies to the same wayland object share the same user data pointer.
The get/set operations are atomic, no more guarantee is given. If you need to synchronise access to this data, it is your responsibility to add a Mutex or any other similar mechanism.
If this proxy is not managed by wayland-client, this does nothing.
fn get_user_data(&self) -> *mut ()
Get the pointer associated as user data on this proxy
All proxies to the same wayland object share the same user data pointer.
See set_user_data
for synchronisation guarantee.
If this proxy is not managed by wayland-client, this returns a null pointer.
unsafe fn clone_unchecked(&self) -> Self where
Self: Sized,
Self: Sized,
Unsafely clone this proxy handle
This function is unsafe because if the proxy is unmanaged, the lib has no knowledge of its lifetime, and cannot ensure that the new handle will not outlive the object.
Provided Methods
fn clone(&self) -> Option<Self> where
Self: Sized,
Self: Sized,
Clone this proxy handle
Will only succeed if the proxy is managed by this library and is still alive.
Implementors
impl Proxy for WlDisplay
impl Proxy for WlRegistry
impl Proxy for WlCallback
impl Proxy for WlCompositor
impl Proxy for WlShmPool
impl Proxy for WlShm
impl Proxy for WlBuffer
impl Proxy for WlDataOffer
impl Proxy for WlDataSource
impl Proxy for WlDataDevice
impl Proxy for WlDataDeviceManager
impl Proxy for WlShell
impl Proxy for WlShellSurface
impl Proxy for WlSurface
impl Proxy for WlSeat
impl Proxy for WlPointer
impl Proxy for WlKeyboard
impl Proxy for WlTouch
impl Proxy for WlOutput
impl Proxy for WlRegion
impl Proxy for WlSubcompositor
impl Proxy for WlSubsurface