Struct wayland_client::proxy::Proxy

source ·
pub struct Proxy<I: Interface> {
    _i: PhantomData<&'static I>,
    pub(crate) inner: ProxyInner,
}
Expand description

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.

Fields§

§_i: PhantomData<&'static I>§inner: ProxyInner

Implementations§

source§

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

source

pub(crate) fn wrap(inner: ProxyInner) -> Proxy<I>

source

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

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.

source

pub fn is_alive(&self) -> bool

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.

source

pub fn version(&self) -> u32

Retrieve the interface version of this wayland object instance

Returns 0 on dead objects

source

pub fn id(&self) -> u32

Retrieve the object id of this wayland object

source

pub fn user_data(&self) -> &UserData

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.

source

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

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

You can also use the PartialEq implementation.

source

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

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.

source

pub fn anonymize(self) -> Proxy<AnonymousObject>

Erase the actual type of this proxy

source§

impl Proxy<AnonymousObject>

source

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

Attempt to recover the typed variant of an anonymous proxy

source§

impl<I: Interface + AsRef<Proxy<I>> + From<Proxy<I>>> Proxy<I>

source

pub fn is_external(&self) -> bool

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.

source

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

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.

source

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

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§

source§

impl AsRef<Proxy<AnonymousObject>> for AnonymousObject

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlBuffer>> for WlBuffer

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlCallback>> for WlCallback

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlCompositor>> for WlCompositor

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlDataDevice>> for WlDataDevice

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlDataDeviceManager>> for WlDataDeviceManager

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlDataOffer>> for WlDataOffer

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlDataSource>> for WlDataSource

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlDisplay>> for WlDisplay

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlKeyboard>> for WlKeyboard

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlOutput>> for WlOutput

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlPointer>> for WlPointer

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlRegion>> for WlRegion

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlRegistry>> for WlRegistry

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlSeat>> for WlSeat

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlShell>> for WlShell

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlShellSurface>> for WlShellSurface

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlShm>> for WlShm

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlShmPool>> for WlShmPool

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlSubcompositor>> for WlSubcompositor

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlSubsurface>> for WlSubsurface

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlSurface>> for WlSurface

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<Proxy<WlTouch>> for WlTouch

source§

fn as_ref(&self) -> &Proxy<Self>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<I: Interface> Clone for Proxy<I>

source§

fn clone(&self) -> Proxy<I>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<I: Interface> Debug for Proxy<I>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<AnonymousObject> for Proxy<AnonymousObject>

source§

fn from(value: AnonymousObject) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<AnonymousObject>> for AnonymousObject

source§

fn from(proxy: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlBuffer>> for WlBuffer

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlCallback>> for WlCallback

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlCompositor>> for WlCompositor

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlDataDevice>> for WlDataDevice

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlDataDeviceManager>> for WlDataDeviceManager

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlDataOffer>> for WlDataOffer

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlDataSource>> for WlDataSource

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlDisplay>> for WlDisplay

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlKeyboard>> for WlKeyboard

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlOutput>> for WlOutput

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlPointer>> for WlPointer

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlRegion>> for WlRegion

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlRegistry>> for WlRegistry

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlSeat>> for WlSeat

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlShell>> for WlShell

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlShellSurface>> for WlShellSurface

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlShm>> for WlShm

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlShmPool>> for WlShmPool

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlSubcompositor>> for WlSubcompositor

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlSubsurface>> for WlSubsurface

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlSurface>> for WlSurface

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<Proxy<WlTouch>> for WlTouch

source§

fn from(value: Proxy<Self>) -> Self

Converts to this type from the input type.
source§

impl From<WlBuffer> for Proxy<WlBuffer>

source§

fn from(value: WlBuffer) -> Self

Converts to this type from the input type.
source§

impl From<WlCallback> for Proxy<WlCallback>

source§

fn from(value: WlCallback) -> Self

Converts to this type from the input type.
source§

impl From<WlCompositor> for Proxy<WlCompositor>

source§

fn from(value: WlCompositor) -> Self

Converts to this type from the input type.
source§

impl From<WlDataDevice> for Proxy<WlDataDevice>

source§

fn from(value: WlDataDevice) -> Self

Converts to this type from the input type.
source§

impl From<WlDataDeviceManager> for Proxy<WlDataDeviceManager>

source§

fn from(value: WlDataDeviceManager) -> Self

Converts to this type from the input type.
source§

impl From<WlDataOffer> for Proxy<WlDataOffer>

source§

fn from(value: WlDataOffer) -> Self

Converts to this type from the input type.
source§

impl From<WlDataSource> for Proxy<WlDataSource>

source§

fn from(value: WlDataSource) -> Self

Converts to this type from the input type.
source§

impl From<WlDisplay> for Proxy<WlDisplay>

source§

fn from(value: WlDisplay) -> Self

Converts to this type from the input type.
source§

impl From<WlKeyboard> for Proxy<WlKeyboard>

source§

fn from(value: WlKeyboard) -> Self

Converts to this type from the input type.
source§

impl From<WlOutput> for Proxy<WlOutput>

source§

fn from(value: WlOutput) -> Self

Converts to this type from the input type.
source§

impl From<WlPointer> for Proxy<WlPointer>

source§

fn from(value: WlPointer) -> Self

Converts to this type from the input type.
source§

impl From<WlRegion> for Proxy<WlRegion>

source§

fn from(value: WlRegion) -> Self

Converts to this type from the input type.
source§

impl From<WlRegistry> for Proxy<WlRegistry>

source§

fn from(value: WlRegistry) -> Self

Converts to this type from the input type.
source§

impl From<WlSeat> for Proxy<WlSeat>

source§

fn from(value: WlSeat) -> Self

Converts to this type from the input type.
source§

impl From<WlShell> for Proxy<WlShell>

source§

fn from(value: WlShell) -> Self

Converts to this type from the input type.
source§

impl From<WlShellSurface> for Proxy<WlShellSurface>

source§

fn from(value: WlShellSurface) -> Self

Converts to this type from the input type.
source§

impl From<WlShm> for Proxy<WlShm>

source§

fn from(value: WlShm) -> Self

Converts to this type from the input type.
source§

impl From<WlShmPool> for Proxy<WlShmPool>

source§

fn from(value: WlShmPool) -> Self

Converts to this type from the input type.
source§

impl From<WlSubcompositor> for Proxy<WlSubcompositor>

source§

fn from(value: WlSubcompositor) -> Self

Converts to this type from the input type.
source§

impl From<WlSubsurface> for Proxy<WlSubsurface>

source§

fn from(value: WlSubsurface) -> Self

Converts to this type from the input type.
source§

impl From<WlSurface> for Proxy<WlSurface>

source§

fn from(value: WlSurface) -> Self

Converts to this type from the input type.
source§

impl From<WlTouch> for Proxy<WlTouch>

source§

fn from(value: WlTouch) -> Self

Converts to this type from the input type.
source§

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

source§

fn eq(&self, other: &Proxy<I>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

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

Auto Trait Implementations§

§

impl<I> !RefUnwindSafe for Proxy<I>

§

impl<I> Send for Proxy<I>where I: Sync,

§

impl<I> Sync for Proxy<I>where I: Sync,

§

impl<I> Unpin for Proxy<I>

§

impl<I> !UnwindSafe for Proxy<I>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.