pub struct Window<Store = ()> { /* private fields */ }Implementations§
Source§impl<Store> Window<Store>
impl<Store> Window<Store>
Sourcepub fn with_size(size: (usize, usize)) -> Self
pub fn with_size(size: (usize, usize)) -> Self
Examples found in repository?
examples/basic.rs (line 12)
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 background(self, fill: impl Into<Color>) -> Self
pub fn background(self, fill: impl Into<Color>) -> Self
Examples found in repository?
examples/basic.rs (line 14)
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 title(self, title: impl Into<String>) -> Self
pub fn title(self, title: impl Into<String>) -> Self
Examples found in repository?
examples/basic.rs (line 13)
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 set_root_component<C>(&mut self, component: C) -> &mut Selfwhere
C: Component<Store> + 'static,
pub fn set_root_component<C>(&mut self, component: C) -> &mut Selfwhere
C: Component<Store> + 'static,
Examples found in repository?
examples/basic.rs (lines 16-24)
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 Window<Store>
impl<Store = ()> !RefUnwindSafe for Window<Store>
impl<Store = ()> !Send for Window<Store>
impl<Store = ()> !Sync for Window<Store>
impl<Store> Unpin for Window<Store>
impl<Store = ()> !UnwindSafe for Window<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