macro_rules! delegate_noop { ($(@< $( $lt:tt $( : $clt:tt $(+ $dlt:tt )* )? ),+ >)? $dispatch_from: ty : $interface: ty) => { ... }; ($(@< $( $lt:tt $( : $clt:tt $(+ $dlt:tt )* )? ),+ >)? $dispatch_from: ty : ignore $interface: ty) => { ... }; }
Expand description
A helper macro which delegates a set of Dispatch
implementations for proxies to a static handler.
§Usage
This macro is useful to implement Dispatch
for interfaces where events are unimportant to
the current application and can be ignored.
§Example
use wayland_client::{delegate_noop, protocol::{wl_data_offer, wl_subcompositor}};
/// The application state
struct ExampleApp {
// ...
}
// Ignore all events for this interface:
delegate_noop!(ExampleApp: ignore wl_data_offer::WlDataOffer);
// This interface should not emit events:
delegate_noop!(ExampleApp: wl_subcompositor::WlSubcompositor);
This last example will execute unreachable!()
if the interface emits any events.