diff --git a/nuon/src/widget/column.rs b/nuon/src/widget/column.rs index bc1e08b..9bd8e96 100644 --- a/nuon/src/widget/column.rs +++ b/nuon/src/widget/column.rs @@ -1,7 +1,9 @@ +use smallvec::SmallVec; + use crate::{Element, Event, LayoutCtx, Node, RenderCtx, Renderer, UpdateCtx, Widget}; pub struct Column<'a, MSG> { - children: Vec>, + children: SmallVec<[Element<'a, MSG>; 4]>, gap: f32, } @@ -14,7 +16,7 @@ impl<'a, MSG> Default for Column<'a, MSG> { impl<'a, MSG> Column<'a, MSG> { pub fn new() -> Self { Self { - children: Vec::new(), + children: SmallVec::new(), gap: 0.0, } } diff --git a/nuon/src/widget/row.rs b/nuon/src/widget/row.rs index 4830391..19d8188 100644 --- a/nuon/src/widget/row.rs +++ b/nuon/src/widget/row.rs @@ -1,7 +1,9 @@ +use smallvec::SmallVec; + use crate::{Element, Event, LayoutCtx, Node, RenderCtx, Renderer, UpdateCtx, Widget}; pub struct Row<'a, MSG> { - children: Vec>, + children: SmallVec<[Element<'a, MSG>; 4]>, gap: f32, } @@ -14,7 +16,7 @@ impl<'a, MSG> Default for Row<'a, MSG> { impl<'a, MSG> Row<'a, MSG> { pub fn new() -> Self { Self { - children: Vec::new(), + children: SmallVec::new(), gap: 0.0, } } diff --git a/nuon/src/widget/stack.rs b/nuon/src/widget/stack.rs index 0919ac5..f9a6130 100644 --- a/nuon/src/widget/stack.rs +++ b/nuon/src/widget/stack.rs @@ -1,7 +1,9 @@ +use smallvec::SmallVec; + use crate::{Element, Event, LayoutCtx, Node, RenderCtx, Renderer, UpdateCtx, Widget}; pub struct Stack<'a, MSG> { - children: Vec>, + children: SmallVec<[Element<'a, MSG>; 4]>, } impl<'a, MSG> Default for Stack<'a, MSG> { @@ -13,7 +15,7 @@ impl<'a, MSG> Default for Stack<'a, MSG> { impl<'a, MSG> Stack<'a, MSG> { pub fn new() -> Self { Self { - children: Vec::new(), + children: SmallVec::new(), } }