[][src]Module wayland_client::sinks

Message sinks

The Wayland model naturally uses callbacks to handle the message you receive from the server. However in some contexts, an iterator-based interface may be more practical to use, this is what this module provides.

The message_iterator function allows you to create a new message iterator. It is just a regular MPSC, however its sending end (the Sink<T>) can be directly used as an implementation for Wayland objects. This just requires that T: From<(I::Event, I)> (where I is the interface of the object you're trying to implement). The event_enum! macro is provided to easily generate an appropriate type joining events from different interfaces into a single iterator.

The blocking_message_iterator function is very similar, except the created message iterator will be linked to an event queue, and will block on it rather than returning None, and is thus able to drive an event loop.

Structs

BlockingMsgIter

A message iterator linked to an event queue

MsgIter

A message iterator

Sink

The sink end of an message iterator.

Functions

blocking_message_iterator

Create a blokcing message iterator

message_iterator

Create a new message iterator and an associated sink.