1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! Proc macros for the textual TUI framework.
//!
//! Provides `#[derive(Reactive)]` for reactive field system.
extern crate proc_macro;
use TokenStream;
/// Derive macro for the reactive field system.
///
/// Annotate struct fields with `#[reactive]`, `#[reactive(layout)]`,
/// `#[reactive(watch)]`, or `#[var]` to generate getters, setters with
/// change detection, and watcher dispatch.
/// Attribute macro for typed message handler dispatch.
///
/// Apply to a method to generate a companion dispatch method that
/// pattern-matches against the `Message` enum and calls the handler
/// with the typed event payload.
///
/// # Usage
///
/// ```ignore
/// #[on(ButtonPressed)]
/// fn handle_button(&mut self, event: &ButtonPressed, ctx: &mut EventCtx) { ... }
///
/// #[on(ButtonPressed, selector = "#save")]
/// fn handle_save(&mut self, event: &ButtonPressed, ctx: &mut EventCtx) { ... }
/// ```