pub struct Parameter<T, Store> { /* private fields */ }Implementations§
Source§impl<T, Store> Parameter<T, Store>
impl<T, Store> Parameter<T, Store>
Sourcepub fn constant(constant: impl Into<T>) -> Selfwhere
T: 'static + Clone,
pub fn constant(constant: impl Into<T>) -> Selfwhere
T: 'static + Clone,
Examples found in repository?
examples/basic.rs (line 18)
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 closure<O>(thunk: impl Fn(&Store) -> O + 'static) -> Selfwhere
O: Into<T>,
pub fn closure<O>(thunk: impl Fn(&Store) -> O + 'static) -> Selfwhere
O: Into<T>,
Examples found in repository?
examples/basic.rs (lines 20-22)
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}Trait Implementations§
Source§impl<P, Store> IntoParameter<P, Store> for Parameter<P, Store>
impl<P, Store> IntoParameter<P, Store> for Parameter<P, Store>
fn into_parameter(self) -> Parameter<P, Store>
Auto Trait Implementations§
impl<T, Store> Freeze for Parameter<T, Store>
impl<T, Store> !RefUnwindSafe for Parameter<T, Store>
impl<T, Store> !Send for Parameter<T, Store>
impl<T, Store> !Sync for Parameter<T, Store>
impl<T, Store> Unpin for Parameter<T, Store>
impl<T, Store> !UnwindSafe for Parameter<T, 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