Struct wayland_client::EventQueue
source · [−]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 in invoking this method in a loop.
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
Auto Trait Implementations
impl<D> !RefUnwindSafe for EventQueue<D>
impl<D> Send for EventQueue<D>
impl<D> Sync for EventQueue<D>
impl<D> Unpin for EventQueue<D>
impl<D> !UnwindSafe for EventQueue<D>
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
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
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
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
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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