Struct wayland_client::EventIterator [] [src]

pub struct EventIterator {
    // some fields omitted
}

Methods

impl EventIterator
[src]

fn next_event_dispatch(&mut self) -> Result<Option<Event>>

Retrieves the next event in this iterator.

Will automatically try to dispatch pending events if necessary.

Similar to a combination of next_event and dispatch_pending.

fn next_event(&mut self) -> Option<Event>

Retrieves the next event in this iterator.

Returns None if no event is available. Some events might still be in the internal buffer, waiting to be dispatched to their EventIterators. Use dispatch_pending() to dispatch the waiting events to this iterator.

fn sync_roundtrip(&mut self) -> Result<i32>

Synchronous roundtrip

This call will cause a synchonous roundtrip with the wayland server. It will block until all pending requests of this queue are send to the server and it has processed all of them and send the appropriate events.

On success returns the number of dispatched events.

fn dispatch_pending(&mut self) -> Result<i32>

Non-blocking dispatch

Will dispatch all pending events from the internal buffer to this event iterator. Will not try to read events from the server socket, hence never blocks.

On success returns the number of dispatched events.

fn dispatch(&mut self) -> Result<i32>

Blocking dispatch

Will dispatch all pending events from the internal buffer to this event iterator. If the buffer was empty, will read new events from the server socket, blocking if necessary.

On success returns the number of dispatched events.

Can cause a deadlock if called several times conccurently on different EventIterator. For a risk-free approach, use prepare_read() and dispatch_pending()

fn prepare_read(&self) -> Option<ReadEventsGuard>

Prepare an conccurent read

Will declare your intention to read events from the server socket.

Will return None if there are still some events awaiting dispatch on this EventIterator. In this case, you need to call dispatch_pending() before calling this method again.

As long as the returned guard is in scope, no events can be dispatched to any event iterator.

The guard can then be destroyed by two means:

  • Calling its cancel() method (or letting it go out of scope): the read intention will be cancelled
  • Calling its read_events() method: will block until all existing guards are destroyed by one of these methods, then events will be read and all blocked read_events() calls will return.

This call will otherwise not block on the server socket if it is empty, and return an io error WouldBlock in such cases.

Trait Implementations

impl Drop for EventIterator
[src]

fn drop(&mut self)

A method called when the value goes out of scope. Read more