pub struct App<Store = ()> { /* private fields */ }Implementations§
Source§impl<Store> App<Store>
impl<Store> App<Store>
Sourcepub fn with_store(store: Store) -> Self
pub fn with_store(store: Store) -> Self
Examples found in repository?
examples/basic.rs (line 11)
9pub fn main() {
10 let store = Store { count: 127 };
11 let mut app = App::with_store(store);
12 let mut window: Window<Store> = Window::with_size((1200, 600))
13 .title("My first window")
14 .background((255, 255, 127));
15
16 window.set_root_component(
17 VStack::new()
18 .size(Parameter::constant((600, 400)))
19 .padding(Parameter::constant((64, 16)))
20 .background(Parameter::closure(|store: &Store| {
21 (store.count as u8, 0, 0)
22 }))
23 .add_child(VStack::new().background(Parameter::constant((0, 255, 0)))),
24 );
25
26 app.add_window(window);
27 app.run().unwrap();
28}Sourcepub fn add_window(&mut self, window: Window<Store>) -> &mut Self
pub fn add_window(&mut self, window: Window<Store>) -> &mut Self
Examples found in repository?
examples/basic.rs (line 26)
9pub fn main() {
10 let store = Store { count: 127 };
11 let mut app = App::with_store(store);
12 let mut window: Window<Store> = Window::with_size((1200, 600))
13 .title("My first window")
14 .background((255, 255, 127));
15
16 window.set_root_component(
17 VStack::new()
18 .size(Parameter::constant((600, 400)))
19 .padding(Parameter::constant((64, 16)))
20 .background(Parameter::closure(|store: &Store| {
21 (store.count as u8, 0, 0)
22 }))
23 .add_child(VStack::new().background(Parameter::constant((0, 255, 0)))),
24 );
25
26 app.add_window(window);
27 app.run().unwrap();
28}Sourcepub fn run(self) -> CharmResult<()>
pub fn run(self) -> CharmResult<()>
Examples found in repository?
examples/basic.rs (line 27)
9pub fn main() {
10 let store = Store { count: 127 };
11 let mut app = App::with_store(store);
12 let mut window: Window<Store> = Window::with_size((1200, 600))
13 .title("My first window")
14 .background((255, 255, 127));
15
16 window.set_root_component(
17 VStack::new()
18 .size(Parameter::constant((600, 400)))
19 .padding(Parameter::constant((64, 16)))
20 .background(Parameter::closure(|store: &Store| {
21 (store.count as u8, 0, 0)
22 }))
23 .add_child(VStack::new().background(Parameter::constant((0, 255, 0)))),
24 );
25
26 app.add_window(window);
27 app.run().unwrap();
28}Auto Trait Implementations§
impl<Store> Freeze for App<Store>where
Store: Freeze,
impl<Store = ()> !RefUnwindSafe for App<Store>
impl<Store = ()> !Send for App<Store>
impl<Store = ()> !Sync for App<Store>
impl<Store> Unpin for App<Store>where
Store: Unpin,
impl<Store = ()> !UnwindSafe for App<Store>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more