Macro relm::connect [] [src]

macro_rules! connect {
    ($widget:expr, $event:ident($($args:pat),*), $other_component:expr, $msg:expr) => { ... };
    ($relm:expr, $widget:expr, $event:ident($($args:pat),*), $msg:expr) => { ... };
    ($relm:expr, $widget:expr, $event:ident($($args:pat),*) $msg:expr) => { ... };
    ($src_component:ident @ $message:pat, $dst_component:ident, $msg:expr) => { ... };
}

Connect events to sending a message.

Rule #1: Send $msg to $other_component when the GTK+ $event is emitted on $widget.

Rule #2: Optionally send $msg.0 when the GTK+ $event is emitted on $widget. Return $msg.1 in the GTK+ callback. This variant gives more control to the caller since it expects a $msg returning (Option<MSG>, ReturnValue) where the ReturnValue is the value to return in the GTK+ callback. Option can be None if no message needs to be emitted.

Rule #3: Send $msg when the GTK+ $event is emitted on $widget.

Rule #4: Send $msg to $widget when the $message is received on $stream.