Struct wayland_server::Display

source ·
pub struct Display { /* private fields */ }
Expand description

The wayland display

This is the core of your wayland server, this object must be kept alive as long as your server is running. It allows you to manage listening sockets and clients.

Implementations

Create a new display

This method provides you a Display and inserts it into an existing calloop::EventLoop.

Note that at this point, your server is not yet ready to receive connections, your need to add listening sockets using the add_socket* methods.

Get a DisplayToken for make non-send implementations

This is required by NewResource::implement_nonsend.

Create a new global object

This object will be advertised to all clients, and they will be able to instantiate it from their registries.

Your implementation will be called whenever a client instantiates this global.

The version specified is the highest supported version, you must be able to handle clients that choose to instantiate this global with a lower version number.

Create a new global object with a filter

This object will be advertised to all clients, and they will be able to instantiate it from their registries.

Your implementation will be called whenever a client instantiates this global.

The version specified is the highest supported version, you must be able to handle clients that choose to instantiate this global with a lower version number.

Flush events to the clients

Will send as many pending events as possible to the respective sockets of the clients. Will not block, but might not send everything if the socket buffer fills up.

Add a listening socket to this display

Wayland clients will be able to connect to your compositor from this socket.

Socket will be created in the directory specified by the environment variable XDG_RUNTIME_DIR.

If a name is provided, it is used. Otherwise, if WAYLAND_DISPLAY environment variable is set, its contents are used as socket name. Otherwise, wayland-0 is used.

Errors if name contains an interior null, or if XDG_RUNTIME_DIR is not set, or if specified could not be bound (either it is already used or the compositor does not have the rights to create it).

Add an automatically named listening socket to this display

Wayland clients will be able to connect to your compositor from this socket.

Socket will be created in the directory specified by the environment variable XDG_RUNTIME_DIR. The directory is scanned for any name in the form wayland-$d with 0 <= $d < 32 and the first available one is used.

Errors if XDG_RUNTIME_DIR is not set, or all 32 names are already in use.

Add existing listening socket to this display

Wayland clients will be able to connect to your compositor from this socket.

The existing socket fd must already be created, opened, and locked. The fd must be properly set to CLOEXEC and bound to a socket file with both bind() and listen() already called. An error is returned otherwise.

Add existing listening socket to this display from a raw file descriptor

Wayland clients will be able to connect to your compositor from this socket.

The library takes ownership of the provided socket if this method returns successfully.

The existing socket fd must already be created, opened, and locked. The fd must be properly set to CLOEXEC and bound to a socket file with both bind() and listen() already called. An error is returned otherwise.

Create a new client to this display from an already-existing connected Fd

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

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.