pub struct Handle { /* private fields */ }
Expand description

Main handle of a backend to the Wayland protocol

This type hosts most of the protocol-related functionality of the backend, and is the main entry point for manipulating Wayland objects. It can be retrieved from the backend via Backend::handle() and cloned, and is given to you as argument in many callbacks.

Implementations

Get a WeakHandle from this handle

Get the detailed protocol information about a wayland object

Returns an error if the provided object ID is no longer valid.

Initializes a connection with a client.

The data parameter contains data that will be associated with the client.

Returns the id of the client which owns the object.

Returns the data associated with a client.

Retrive the Credentials of a client

Invokes a closure for all clients connected to this server

Note that while this method is running, an internal lock of the backend is held, as a result invoking other methods of the Handle within the closure will deadlock. You should thus store the relevant ClientId in a container of your choice and process them after this method has returned.

Invokes a closure for all objects owned by a client.

Note that while this method is running, an internal lock of the backend is held, as a result invoking other methods of the Handle within the closure will deadlock. You should thus store the relevant ObjectId in a container of your choice and process them after this method has returned.

Retrieve the ObjectId for a wayland object given its protocol numerical ID

Create a new object for given client

To ensure state coherence of the protocol, the created object should be immediately sent as a “New ID” argument in an event to the client.

Panics

This method will panic if the type parameter D is not same to the same type as the one the backend was initialized with.

Send an event to the client

Returns an error if the sender ID of the provided message is no longer valid.

Panics

Checks against the protocol specification are done, and this method will panic if they do not pass:

  • the message opcode must be valid for the sender interface
  • the argument list must match the prototype for the message associated with this opcode

Returns the data associated with an object.

Panic: This method will panic if the type parameter D is not same to the same type as the one the backend was initialized with.

Returns the data associated with an object as a dyn Any

Sets the data associated with some object.

Panic: This method will panic if the type parameter D is not same to the same type as the one the backend was initialized with.

Posts a protocol error on an object. This will also disconnect the client which created the object.

Kills the connection to a client.

The disconnection reason determines the error message that is sent to the client (if any).

Creates a global of the specified interface and version and then advertises it to clients.

The clients which the global is advertised to is determined by the implementation of the GlobalHandler.

Panic: This method will panic if the type parameter D is not same to the same type as the one the backend was initialized with.

Disables a global object that is currently active.

The global removal will be signaled to all currently connected clients. New clients will not know of the global, but the associated state and callbacks will not be freed. As such, clients that still try to bind the global afterwards (because they have not yet realized it was removed) will succeed.

Invoking this method on an already disabled or removed global does nothing. It is not possible to re-enable a disabled global, this method is meant to be invoked some time before actually removing the global, to avoid killing clients because of a race.

Panic: This method will panic if the type parameter D is not same to the same type as the one the backend was initialized with.

Removes a global object and free its ressources.

The global object will no longer be considered valid by the server, clients trying to bind it will be killed, and the global ID is freed for re-use.

It is advised to first disable a global and wait some amount of time before removing it, to ensure all clients are correctly aware of its removal. Note that clients will generally not expect globals that represent a capability of the server to be removed, as opposed to globals representing peripherals (like wl_output or wl_seat).

This methods does nothing if the provided GlobalId corresponds to an already removed global.

Panic: This method will panic if the type parameter D is not same to the same type as the one the backend was initialized with.

Returns information about a global.

Returns the handler which manages the visibility and notifies when a client has bound the global.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more
Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more
Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more
Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.