[][src]Struct wayland_client::Proxy

pub struct Proxy<I: Interface> { /* fields omitted */ }

An handle to a wayland proxy

This represents a wayland object instantiated in your client session. Several handles to the same object can exist at a given time, and cloning them won't create a new protocol object, only clone the handle. The lifetime of the protocol object is not tied to the lifetime of these handles, but rather to sending or receiving destroying messages.

These handles are notably used to send requests to the server. To do this you need to convert them to the corresponding Rust object (using .into()) and use methods on the Rust object.

This handle is the most conservative one: it can be sent between threads, but you cannot send any message that would create a new object using it. You must attach it to a event queue, that will host the newly created objects.

Implementations

impl<I: Interface> Proxy<I> where
    I: AsRef<Proxy<I>> + From<Proxy<I>>, 
[src]

pub fn send<J>(&self, msg: I::Request, version: Option<u32>) -> Option<Main<J>> where
    J: Interface + AsRef<Proxy<J>> + From<Proxy<J>>, 
[src]

Send a request creating an object through this object

Warning: This method is mostly intended to be used by code generated by wayland-scanner, and you should probably never need to use it directly, but rather use the appropriate methods on the Rust object.

This is the generic method to send requests.

pub fn is_alive(&self) -> bool[src]

Check if the object associated with this proxy is still alive

Will return false if the object has been destroyed.

If the object is not managed by this library (if it was created from a raw pointer from some other library your program interfaces with), this will always returns true.

pub fn version(&self) -> u32[src]

Retrieve the interface version of this wayland object instance

Returns 0 on dead objects

pub fn id(&self) -> u32[src]

Retrieve the object id of this wayland object

pub fn user_data(&self) -> &UserData[src]

Access the UserData associated to this object

Each wayland object has an associated UserData, that can store a payload of arbitrary type and is shared by all proxies of this object.

See UserData documentation for more details.

pub fn equals(&self, other: &Proxy<I>) -> bool[src]

Check if the other proxy refers to the same underlying wayland object

You can also use the PartialEq implementation.

pub fn attach(&self, token: QueueToken) -> Attached<I>[src]

Attach this proxy to the event queue represented by this token

Once a proxy is attached, you can use it to send requests that create new objects. These new objects will be handled by the event queue represented by the provided token.

This does not impact the events received by this object, which are still handled by their original event queue.

pub fn anonymize(self) -> Proxy<AnonymousObject>[src]

Erase the actual type of this proxy

impl Proxy<AnonymousObject>[src]

pub fn deanonymize<I: Interface>(self) -> Result<Proxy<I>, Self>[src]

Attempt to recover the typed variant of an anonymous proxy

impl<I: Interface + AsRef<Proxy<I>> + From<Proxy<I>>> Proxy<I>[src]

pub fn is_external(&self) -> bool[src]

Check whether this proxy is managed by the library or not

See from_c_ptr for details.

NOTE: This method will panic if called while the use_system_lib feature is not activated.

pub fn c_ptr(&self) -> *mut wl_proxy[src]

Get a raw pointer to the underlying wayland object

Retrieve a pointer to the object from the libwayland-client.so library. You will mostly need it to interface with C libraries needing access to wayland objects (to initialize an opengl context for example).

NOTE: This method will panic if called while the use_system_lib feature is not activated.

pub unsafe fn from_c_ptr(_ptr: *mut wl_proxy) -> Proxy<I> where
    I: From<Proxy<I>>, 
[src]

Create a Proxy instance from a C pointer

Create a Proxy from a raw pointer to a wayland object from the C library.

If the pointer was previously obtained by the c_ptr() method, this constructs a new proxy for the same object just like the clone() method would have.

If the object was created by some other C library you are interfacing with, it will be created in an "unmanaged" state: wayland-client will treat it as foreign, and as such most of the safeties will be absent. Notably the lifetime of the object can't be tracked, so the alive() method will always return true and you are responsible of not using an object past its destruction (as this would cause a protocol error). You will also be unable to associate any user data value to this object.

In order to handle protocol races, invoking it with a NULL pointer will create an already-dead object.

NOTE: This method will panic if called while the use_system_lib feature is not activated.

Safety

The provided pointer must point to a valid wayland object from libwayland-client with the correct interface.

Trait Implementations

impl AsRef<Proxy<AnonymousObject>> for AnonymousObject[src]

impl AsRef<Proxy<WlBuffer>> for WlBuffer[src]

impl AsRef<Proxy<WlCallback>> for WlCallback[src]

impl AsRef<Proxy<WlCompositor>> for WlCompositor[src]

impl AsRef<Proxy<WlDataDevice>> for WlDataDevice[src]

impl AsRef<Proxy<WlDataDeviceManager>> for WlDataDeviceManager[src]

impl AsRef<Proxy<WlDataOffer>> for WlDataOffer[src]

impl AsRef<Proxy<WlDataSource>> for WlDataSource[src]

impl AsRef<Proxy<WlDisplay>> for WlDisplay[src]

impl AsRef<Proxy<WlKeyboard>> for WlKeyboard[src]

impl AsRef<Proxy<WlOutput>> for WlOutput[src]

impl AsRef<Proxy<WlPointer>> for WlPointer[src]

impl AsRef<Proxy<WlRegion>> for WlRegion[src]

impl AsRef<Proxy<WlRegistry>> for WlRegistry[src]

impl AsRef<Proxy<WlSeat>> for WlSeat[src]

impl AsRef<Proxy<WlShell>> for WlShell[src]

impl AsRef<Proxy<WlShellSurface>> for WlShellSurface[src]

impl AsRef<Proxy<WlShm>> for WlShm[src]

impl AsRef<Proxy<WlShmPool>> for WlShmPool[src]

impl AsRef<Proxy<WlSubcompositor>> for WlSubcompositor[src]

impl AsRef<Proxy<WlSubsurface>> for WlSubsurface[src]

impl AsRef<Proxy<WlSurface>> for WlSurface[src]

impl AsRef<Proxy<WlTouch>> for WlTouch[src]

impl<I: Interface> Clone for Proxy<I>[src]

impl<I: Interface> Debug for Proxy<I>[src]

impl<I: Interface> Eq for Proxy<I> where
    I: AsRef<Proxy<I>> + From<Proxy<I>>, 
[src]

impl From<AnonymousObject> for Proxy<AnonymousObject>[src]

impl From<Proxy<AnonymousObject>> for AnonymousObject[src]

impl From<Proxy<WlBuffer>> for WlBuffer[src]

impl From<Proxy<WlCallback>> for WlCallback[src]

impl From<Proxy<WlCompositor>> for WlCompositor[src]

impl From<Proxy<WlDataDevice>> for WlDataDevice[src]

impl From<Proxy<WlDataDeviceManager>> for WlDataDeviceManager[src]

impl From<Proxy<WlDataOffer>> for WlDataOffer[src]

impl From<Proxy<WlDataSource>> for WlDataSource[src]

impl From<Proxy<WlDisplay>> for WlDisplay[src]

impl From<Proxy<WlKeyboard>> for WlKeyboard[src]

impl From<Proxy<WlOutput>> for WlOutput[src]

impl From<Proxy<WlPointer>> for WlPointer[src]

impl From<Proxy<WlRegion>> for WlRegion[src]

impl From<Proxy<WlRegistry>> for WlRegistry[src]

impl From<Proxy<WlSeat>> for WlSeat[src]

impl From<Proxy<WlShell>> for WlShell[src]

impl From<Proxy<WlShellSurface>> for WlShellSurface[src]

impl From<Proxy<WlShm>> for WlShm[src]

impl From<Proxy<WlShmPool>> for WlShmPool[src]

impl From<Proxy<WlSubcompositor>> for WlSubcompositor[src]

impl From<Proxy<WlSubsurface>> for WlSubsurface[src]

impl From<Proxy<WlSurface>> for WlSurface[src]

impl From<Proxy<WlTouch>> for WlTouch[src]

impl From<WlBuffer> for Proxy<WlBuffer>[src]

impl From<WlCallback> for Proxy<WlCallback>[src]

impl From<WlCompositor> for Proxy<WlCompositor>[src]

impl From<WlDataDevice> for Proxy<WlDataDevice>[src]

impl From<WlDataDeviceManager> for Proxy<WlDataDeviceManager>[src]

impl From<WlDataOffer> for Proxy<WlDataOffer>[src]

impl From<WlDataSource> for Proxy<WlDataSource>[src]

impl From<WlDisplay> for Proxy<WlDisplay>[src]

impl From<WlKeyboard> for Proxy<WlKeyboard>[src]

impl From<WlOutput> for Proxy<WlOutput>[src]

impl From<WlPointer> for Proxy<WlPointer>[src]

impl From<WlRegion> for Proxy<WlRegion>[src]

impl From<WlRegistry> for Proxy<WlRegistry>[src]

impl From<WlSeat> for Proxy<WlSeat>[src]

impl From<WlShell> for Proxy<WlShell>[src]

impl From<WlShellSurface> for Proxy<WlShellSurface>[src]

impl From<WlShm> for Proxy<WlShm>[src]

impl From<WlShmPool> for Proxy<WlShmPool>[src]

impl From<WlSubcompositor> for Proxy<WlSubcompositor>[src]

impl From<WlSubsurface> for Proxy<WlSubsurface>[src]

impl From<WlSurface> for Proxy<WlSurface>[src]

impl From<WlTouch> for Proxy<WlTouch>[src]

impl<I: Interface> PartialEq<Proxy<I>> for Proxy<I> where
    I: AsRef<Proxy<I>> + From<Proxy<I>>, 
[src]

Auto Trait Implementations

impl<I> !RefUnwindSafe for Proxy<I>[src]

impl<I> Send for Proxy<I> where
    I: Sync
[src]

impl<I> Sync for Proxy<I> where
    I: Sync
[src]

impl<I> Unpin for Proxy<I>[src]

impl<I> !UnwindSafe for Proxy<I>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Send + Sync + Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.