pub struct EventQueue<D> { /* private fields */ }
Expand description

An event queue

This is an abstraction for handling event dispatching, that allows you to ensure access to some common state &mut D to your event handlers.

Event queues are created through Connection::new_event_queue(). Upon creation, a wayland object is assigned to an event queue by passing the associated QueueHandle as argument to the method creating it. All event received by that object will be processed by that event queue, when dispatch_pending() or blocking_dispatch() is invoked.

Implementations

Get a QueueHandle for this event queue

Dispatch pending events

Events are accumulated in the event queue internal buffer when the Wayland socket is read using the read APIs on Connection, or when reading is done from an other thread. This method will dispatch all such pending events by sequentially invoking their associated handlers: the Dispatch implementations on the provided &mut D.

Block waiting for events and dispatch them

This method is similar to dispatch_pending, but if there are no pending events it will also block waiting for the Wayland server to send an event.

A simple app event loop can consist of invoking this method in a loop.

Synchronous roundtrip

This function will cause a synchronous round trip with the wayland server. This function will block until all requests in the queue are sent and processed by the server.

This function may be useful during initial setup with the compositor. This function may also be useful where you need to guarantee all requests prior to calling this function are completed.

Start a synchronized read from the socket

This is needed if you plan to wait on readiness of the Wayland socket using an event loop. See ReadEventsGuard for details. Once the events are received, you’ll then need to dispatch them from the event queue using EventQueue::dispatch_pending().

If you don’t need to manage multiple event sources, see blocking_dispatch() for a simpler mechanism.

Flush pending outgoing events to the server

This needs to be done regularly to ensure the server receives all your requests.

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.