pub struct Display<State: 'static> { /* private fields */ }
Expand description

The Wayland display

This struct is the core of your Wayland compositor. You’ll use it in your event loop to drive the protocol processing of all your clients. All other interactions with the protocol itself are done through the DisplayHandle struct, on which the State type parameter is erased for convenience.

Usage

The main loop of a Wayland compositor generally needs to wait on several sources of events, using tools like epoll (on Linux). The Wayland display can be integrated in this mechanism by getting the file descriptor as from .backend().poll_fd() and invoking the dispatch_clients() method whenever it becomes readable.

To ensure all clients receive the events your compositor sends them, you also need to regularly invoke the flush_clients() method, which will write the outgoing buffers into the sockets.

Implementations

Create a new Wayland display

Can only fail if both the server_system and dlopen features of wayland-backend were enabled, and the libwayland-server.so library could not be found.

Retrieve a DisplayHandle for this Display.

This is the type with which all of your interactions with the Wayland protocol are done.

Dispatch all requests received from clients to their respective callbacks.

The state argument is the main state of your compositor, which will be accessible from most of your callbacks.

Flush outgoing buffers into their respective sockets.

Access the underlying Backend of this Display

Trait Implementations

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 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.