@@ -13,7 +13,7 @@ fn main() {
1313 . with_max_level ( compio_log:: Level :: INFO )
1414 . init ( ) ;
1515
16- App :: new ( ) . run :: < MainModel > ( ( ) , & ( ) ) ;
16+ App :: new ( ) . run :: < MainModel > ( ( ) ) ;
1717}
1818
1919struct MainModel {
@@ -54,62 +54,61 @@ enum MainMessage {
5454
5555impl Component for MainModel {
5656 type Event = ( ) ;
57- type Init = ( ) ;
57+ type Init < ' a > = ( ) ;
5858 type Message = MainMessage ;
59- type Root = ( ) ;
6059
61- fn init ( _init : Self :: Init , _root : & Self :: Root , _sender : & ComponentSender < Self > ) -> Self {
62- let mut window = Child :: < Window > :: init ( ( ) , & ( ) ) ;
63- let canvas = Child :: < Canvas > :: init ( ( ) , & window) ;
60+ fn init ( _init : Self :: Init < ' _ > , _sender : & ComponentSender < Self > ) -> Self {
61+ let mut window = Child :: < Window > :: init ( ( ) ) ;
62+ let canvas = Child :: < Canvas > :: init ( & window) ;
6463
6564 window. set_text ( "Widgets example" ) ;
6665 window. set_size ( Size :: new ( 800.0 , 600.0 ) ) ;
6766
68- let mut ulabel = Child :: < Label > :: init ( ( ) , & window) ;
67+ let mut ulabel = Child :: < Label > :: init ( & window) ;
6968 ulabel. set_text ( "Username:" ) ;
7069 ulabel. set_halign ( HAlign :: Right ) ;
71- let mut plabel = Child :: < Label > :: init ( ( ) , & window) ;
70+ let mut plabel = Child :: < Label > :: init ( & window) ;
7271 plabel. set_text ( "Password:" ) ;
7372 plabel. set_halign ( HAlign :: Right ) ;
7473
75- let mut uentry = Child :: < Edit > :: init ( ( ) , & window) ;
74+ let mut uentry = Child :: < Edit > :: init ( & window) ;
7675 uentry. set_text ( "AAA" ) ;
77- let mut pentry = Child :: < Edit > :: init ( ( ) , & window) ;
76+ let mut pentry = Child :: < Edit > :: init ( & window) ;
7877 pentry. set_password ( true ) ;
7978 pentry. set_text ( "123456" ) ;
8079
81- let mut pcheck = Child :: < CheckBox > :: init ( ( ) , & window) ;
80+ let mut pcheck = Child :: < CheckBox > :: init ( & window) ;
8281 pcheck. set_checked ( false ) ;
8382 pcheck. set_text ( "Show" ) ;
8483
85- let combo = Child :: < ComboBox > :: init ( ( ) , & window) ;
84+ let combo = Child :: < ComboBox > :: init ( & window) ;
8685
87- let mut list = Child :: < ObservableVec < String > > :: init ( vec ! [ ] , & ( ) ) ;
86+ let mut list = Child :: < ObservableVec < String > > :: init ( vec ! [ ] ) ;
8887 // https://www.zhihu.com/question/23600507/answer/140640887
8988 list. push ( "烫烫烫" . into ( ) ) ;
9089 list. push ( "昍昍昍" . into ( ) ) ;
9190 list. push ( "フフフフフフ" . into ( ) ) ;
9291 list. push ( "쳌쳌쳌" . into ( ) ) ;
9392
94- let mut r1 = Child :: < RadioButton > :: init ( ( ) , & window) ;
93+ let mut r1 = Child :: < RadioButton > :: init ( & window) ;
9594 r1. set_text ( "屯屯屯" ) ;
9695 r1. set_checked ( true ) ;
97- let mut r2 = Child :: < RadioButton > :: init ( ( ) , & window) ;
96+ let mut r2 = Child :: < RadioButton > :: init ( & window) ;
9897 r2. set_text ( "锟斤拷" ) ;
99- let mut r3 = Child :: < RadioButton > :: init ( ( ) , & window) ;
98+ let mut r3 = Child :: < RadioButton > :: init ( & window) ;
10099 r3. set_text ( "╠╠╠" ) ;
101100
102- let mut push_button = Child :: < Button > :: init ( ( ) , & window) ;
101+ let mut push_button = Child :: < Button > :: init ( & window) ;
103102 push_button. set_text ( "Push" ) ;
104- let mut pop_button = Child :: < Button > :: init ( ( ) , & window) ;
103+ let mut pop_button = Child :: < Button > :: init ( & window) ;
105104 pop_button. set_text ( "Pop" ) ;
106- let mut show_button = Child :: < Button > :: init ( ( ) , & window) ;
105+ let mut show_button = Child :: < Button > :: init ( & window) ;
107106 show_button. set_text ( "Show" ) ;
108107
109- let mut progress = Child :: < Progress > :: init ( ( ) , & window) ;
108+ let mut progress = Child :: < Progress > :: init ( & window) ;
110109 progress. set_indeterminate ( true ) ;
111110
112- let mut mltext = Child :: < TextBox > :: init ( ( ) , & window) ;
111+ let mut mltext = Child :: < TextBox > :: init ( & window) ;
113112 mltext. set_text ( "This is an example of\n multi-line text box." ) ;
114113
115114 window. show ( ) ;
0 commit comments