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),*), return $msg:expr) => { ... };
    ($relm:expr, $widget:expr, $event:ident($($args:pat),*), $msg:expr) => { ... };
    ($src_component:ident @ $message:pat, $dst_component:expr, $msg:expr) => { ... };
}

Connect events to sending a message.

Rules

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

  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.

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

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