VStack

Struct VStack 

Source
pub struct VStack<Store> { /* private fields */ }

Implementations§

Source§

impl<Store> VStack<Store>

Source

pub fn new() -> Self

Examples found in repository?
examples/basic.rs (line 17)
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_child<C>(self, component: C) -> Self
where C: Component<Store> + 'static,

Examples found in repository?
examples/basic.rs (line 23)
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 size(self, size: Parameter<Size, Store>) -> Self

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

pub fn padding(self, padding: Parameter<Padding, Store>) -> Self

Examples found in repository?
examples/basic.rs (line 19)
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 background(self, fill: Parameter<Color, Store>) -> Self

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<Store> Component<Store> for VStack<Store>

Source§

fn render<'a>( &self, ctx: RenderCtx, r: &mut Renderer<'_>, store: &Store, ) -> CharmResult<Bounds>

Auto Trait Implementations§

§

impl<Store> Freeze for VStack<Store>

§

impl<Store> !RefUnwindSafe for VStack<Store>

§

impl<Store> !Send for VStack<Store>

§

impl<Store> !Sync for VStack<Store>

§

impl<Store> Unpin for VStack<Store>

§

impl<Store> !UnwindSafe for VStack<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.