Macro wayland_client::declare_handler [] [src]

macro_rules! declare_handler {
    ($handler_struct: ident <$($tyarg:ident : [$($trait: ident $(<$($traitarg:ty),*>)*),*]),*>, $handler_trait: path, $handled_type: ty) => { ... };
    ($handler_struct: ident, $handler_trait: path, $handled_type: ty) => { ... };
}

Registers a handler type so it can be used in event queue

After having implemented the appropriate Handler trait for your type, declare it via this macro, like this:

struct MyHandler;

impl wl_foo::Handler for MyHandler {
    ...
}

declare_handler!(MyHandler, wl_foo::Handler, wl_foo::WlFoo);

If your type has type arguments, they must be specified using this special syntax to describe constraints on them:

// Note that even if there are no constraints on U, there is a need to put this "empty list"
declare_handler!(MyHandler<T: [Trait1, Trait2], U: []>, wl_foo::Handler, wl_foo::WlFoo);