wayland_client

Trait Proxy

source
pub trait Proxy:
    Clone
    + Debug
    + Sized {
    type Event;
    type Request<'a>;

Show 14 methods // Required methods fn interface() -> &'static Interface; fn id(&self) -> ObjectId; fn version(&self) -> u32; fn data<U: Send + Sync + 'static>(&self) -> Option<&U>; fn object_data(&self) -> Option<&Arc<dyn ObjectData>>; fn backend(&self) -> &WeakBackend; fn from_id(conn: &Connection, id: ObjectId) -> Result<Self, InvalidId>; fn inert(backend: WeakBackend) -> Self; fn send_request(&self, req: Self::Request<'_>) -> Result<(), InvalidId>; fn send_constructor<I: Proxy>( &self, req: Self::Request<'_>, data: Arc<dyn ObjectData>, ) -> Result<I, InvalidId>; fn parse_event( conn: &Connection, msg: Message<ObjectId, OwnedFd>, ) -> Result<(Self, Self::Event), DispatchError>; fn write_request<'a>( &self, conn: &Connection, req: Self::Request<'a>, ) -> Result<(Message<ObjectId, BorrowedFd<'a>>, Option<(&'static Interface, u32)>), InvalidId>; // Provided methods fn is_alive(&self) -> bool { ... } fn downgrade(&self) -> Weak<Self> { ... }
}
Expand description

Trait representing a Wayland interface

Required Associated Types§

source

type Event

The event enum for this interface

source

type Request<'a>

The request enum for this interface

Required Methods§

source

fn interface() -> &'static Interface

The interface description

source

fn id(&self) -> ObjectId

The ID of this object

source

fn version(&self) -> u32

The version of this object

source

fn data<U: Send + Sync + 'static>(&self) -> Option<&U>

Access the user-data associated with this object

source

fn object_data(&self) -> Option<&Arc<dyn ObjectData>>

Access the raw data associated with this object.

For objects created using the scanner-generated methods, this will be an instance of the QueueProxyData type.

source

fn backend(&self) -> &WeakBackend

Access the backend associated with this object

source

fn from_id(conn: &Connection, id: ObjectId) -> Result<Self, InvalidId>

Create an object proxy from its ID

Returns an error this the provided object ID does not correspond to the Self interface.

Note: This method is mostly meant as an implementation detail to be used by code generated by wayland-scanner.

source

fn inert(backend: WeakBackend) -> Self

Create an inert object proxy

Note: This method is mostly meant as an implementation detail to be used by code generated by wayland-scanner.

source

fn send_request(&self, req: Self::Request<'_>) -> Result<(), InvalidId>

Send a request for this object.

It is an error to use this function on requests that create objects; use send_constructor() for such requests.

source

fn send_constructor<I: Proxy>( &self, req: Self::Request<'_>, data: Arc<dyn ObjectData>, ) -> Result<I, InvalidId>

Send a request for this object that creates another object.

It is an error to use this function on requests that do not create objects; use send_request() for such requests.

source

fn parse_event( conn: &Connection, msg: Message<ObjectId, OwnedFd>, ) -> Result<(Self, Self::Event), DispatchError>

Parse a event for this object

Note: This method is mostly meant as an implementation detail to be used by code generated by wayland-scanner.

source

fn write_request<'a>( &self, conn: &Connection, req: Self::Request<'a>, ) -> Result<(Message<ObjectId, BorrowedFd<'a>>, Option<(&'static Interface, u32)>), InvalidId>

Serialize a request for this object

Note: This method is mostly meant as an implementation detail to be used by code generated by wayland-scanner.

Provided Methods§

source

fn is_alive(&self) -> bool

Checks if the Wayland object associated with this proxy is still alive

source

fn downgrade(&self) -> Weak<Self>

Creates a weak handle to this object

This weak handle will not keep the user-data associated with the object alive, and can be converted back to a full proxy using Weak::upgrade().

This can be of use if you need to store proxies in the used data of other objects and want to be sure to avoid reference cycles that would cause memory leaks.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

source§

impl Proxy for WlBuffer

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlCallback

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlCompositor

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlDataDevice

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlDataDeviceManager

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlDataOffer

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlDataSource

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlDisplay

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlKeyboard

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlOutput

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlPointer

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlRegion

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlRegistry

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlSeat

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlShell

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlShellSurface

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlShm

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlShmPool

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlSubcompositor

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlSubsurface

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlSurface

source§

type Request<'request> = Request<'request>

source§

type Event = Event

source§

impl Proxy for WlTouch

source§

type Request<'request> = Request<'request>

source§

type Event = Event