macro_rules! event_created_child {
    ($selftype:ty, $iface:ty, [$($opcode:expr => ($child_iface:ty, $child_udata:expr)),* $(,)?]) => { ... };
}
Expand description

Macro used to override Dispatch::event_created_child()

Use this macro inside the Dispatch implementation to override this method, to implement the initialization of the user data for event-created objects. The usage syntax is as follow:

impl Dispatch<WlFoo> for MyState {
    type UserData = FooUserData;

    fn event(
        &mut self,
        proxy: &WlFoo,
        event: FooEvent,
        data: &FooUserData,
        connhandle: &mut ConnectionHandle,
        qhandle: &QueueHandle<MyState>
    ) {
        /* ... */
    }

    event_created_child!(MyState, WlFoo, [
    // there can be multiple lines if this interface has multiple object-creating event
        2 => (WlBar, BarUserData::new()),
    //  ~     ~~~~~  ~~~~~~~~~~~~~~~~~~
    //  |       |       |
    //  |       |       +-- an expression whose evaluation produces the user data value
    //  |       +-- the type of the newly created objecy
    //  +-- the opcode of the event that creates a new object
    ]);
}