Struct wayland_client::Display

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

A connection to a wayland server

This object both represent the connection to the server, and as such must be kept alive as long as you are connected, and contains the primary WlDisplay wayland object, from which you can create all your need objects. The inner Proxy<WlDisplay> can be accessed via Deref.

Implementations

Attempt to connect to a wayland server using the contents of the environment variables

First of all, if the WAYLAND_SOCKET environment variable is set, it’ll try to interpret it as a FD number to use

If the WAYLAND_DISPLAY variable is set, it will try to connect to the socket it points to. Otherwise, it will default to wayland-0.

On success, you are given the Display object as well as the main EventQueue hosting the WlDisplay wayland object.

This requires the XDG_RUNTIME_DIR variable to be properly set.

Attempt to connect to a wayland server socket with given name

On success, you are given the Display object as well as the main EventQueue hosting the WlDisplay wayland object.

This requires the XDG_RUNTIME_DIR variable to be properly set.

Attempt to use an already connected unix socket on given FD to start a wayland connection

On success, you are given the Display object as well as the main EventQueue hosting the WlDisplay wayland object.

Will take ownership of the FD.

Non-blocking write to the server

Outgoing messages to the server are buffered by the library for efficiency. This method flushes the internal buffer to the server socket.

Will write as many pending requests as possible to the server socket. Never blocks: if not all requests could be written, will return an io error WouldBlock.

On success returns the number of written requests.

Create a new event queue associated with this wayland connection

Methods from Deref<Target = Proxy<WlDisplay>>

Send a request 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 RequestsTrait for your proxy.

This is the generic method to send requests.

If your request needs to create an object, use send_constructor.

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 RequestsTrait for your proxy.

This is the generic method to send requests that create objects

The slot in the message corresponding with the newly created object must have been filled by a placeholder object (see child_placeholder).

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, this will always returns true.

Retrieve the interface version of this wayland object instance

Returns 0 on dead objects

Retrieve the object id of this wayland object

Access the arbitrary payload associated to this object

You need to specify the expected type of this payload, and this function will return None if either the types don’t match or you are attempting to access a non Send + Sync user data from the wrong thread.

This value is associated to the Proxy when you implement it, and you cannot access it mutably afterwards. If you need interior mutability, you are responsible for using a Mutex or similar type to achieve it.

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

Create a new child 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 RequestsTrait for your proxy.

This creates a new wayland object, considered as a child of this object. It will notably inherit its interface version.

The created object should immediately be implemented and sent in a request to the server, to keep the object list properly synchronized. Failure to do so will likely cause a protocol error.

Creates a handle of this proxy with its actual type erased

Create a wrapper for this object for queue management

As assigning a proxy to an event queue can be a racy operation in contexts involving multiple thread, this provides a facility to do this safely.

The wrapper object created behaves like a regular Proxy, except that all objects created as the result of its requests will be assigned to the queue associated to the provided token, rather than the queue of their parent. This does not change the queue of the proxy itself.

Create a placeholder object, to be used with send_constructor

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 RequestsTrait for your proxy.

Trait Implementations

The resulting type after dereferencing.
Dereferences the value.

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.