App

Struct App 

Source
pub struct App<Store = ()> { /* private fields */ }

Implementations§

Source§

impl App<()>

Source

pub fn new() -> Self

Source§

impl<Store> App<Store>

Source

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}
Source

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}
Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.