[][src]Macro subscript::subs

macro_rules! subs {
    () => { ... };
    ($($kind:ident $fn_name:ident $args:tt -> $msg:ty {$($body:tt)*})*) => { ... };
}

Core to Subscript component-to-component communication. In essence we map events to messages, nothing more.

let subs: Subscriptions = subs!{
    msg url_changed(value: UrlChanged) -> Msg {
        Msg::UrlChanged(
            url_parser
                .clone()
                .parse(&value.url())
        )
    }
    msg url_request(value: UrlRequest) -> Msg {
        Msg::UrlRequest(value.0)
    }
};

Note that the terminology is a bit overloaded here (for lack of a better name). If it helps, think of Msg as the Spec’s internal message type, and subscription messages as global messages.

Framework generated global-messages

  • UrlChanged: Emitted whenever the URL changes.