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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
use proc_macro2::{Span as Span2, TokenStream as TokenStream2};
use syn::{punctuated::Punctuated, token, token::Mut, Expr, ExprClosure, Generics, Ident, Path};
use crate::args::Args;
mod gen;
mod parse;
#[derive(Debug)]
pub(super) struct Tracker {
bool_fn: Expr,
update_fns: Vec<Expr>,
}
#[derive(Debug)]
pub(super) enum PropertyType {
Expr(Expr),
Track(Tracker),
Parent(Expr),
Args(Args<Expr>),
Connect(ExprClosure),
ConnectComponent(ExprClosure),
Watch(TokenStream2),
Factory(Expr),
Widget(Widget),
}
#[derive(Debug)]
pub enum PropertyName {
Ident(Ident),
Path(Path),
}
#[derive(Debug)]
pub(super) struct Property {
pub name: PropertyName,
pub ty: PropertyType,
pub generics: Option<Generics>,
pub args: Option<Args<Expr>>,
pub optional_assign: bool,
pub iterative: bool,
}
#[derive(Debug)]
pub(super) struct Properties {
pub properties: Vec<Property>,
}
#[derive(Debug)]
pub(super) struct WidgetFunc {
pub path_segments: Vec<Ident>,
pub args: Option<Punctuated<Expr, token::Comma>>,
pub ty: Option<Vec<Ident>>,
pub span: Span2,
}
#[derive(Debug)]
pub(super) struct Widget {
pub mutable: Option<Mut>,
pub name: Ident,
pub func: WidgetFunc,
pub properties: Properties,
pub wrapper: Option<Ident>,
pub ref_token: Option<token::And>,
pub deref_token: Option<token::Star>,
pub returned_widget: Option<ReturnedWidget>,
}
#[derive(Debug)]
pub(super) struct ReturnedWidget {
pub name: Ident,
pub ty: Option<Path>,
pub properties: Properties,
pub is_optional: bool,
}