pub struct Grid {
pub id: Option<NodeId>,
pub children: Vec<Node>,
pub columns: Vec<GridTrack>,
pub rows: Vec<GridTrack>,
pub column_gap: Option<f32>,
pub row_gap: Option<f32>,
pub padding: [f32; 4],
}Expand description
A CSS-grid-style layout container.
Define column and row tracks with GridTrack values (points, fractions,
percentages, or auto) and place children using GridItem.
§Example
ⓘ
Grid {
columns: vec![GridTrack::Fr(1.0), GridTrack::Fr(2.0)],
rows: vec![GridTrack::Points(40.0), GridTrack::Auto],
column_gap: Some(8.0),
row_gap: Some(8.0),
children: vec![
GridItem::new(Text::new("A").into_node()).cell(1, 1).into_node().into(),
GridItem::new(Text::new("B").into_node()).cell(1, 2).into_node().into(),
],
..Default::default()
}Fields§
§id: Option<NodeId>Explicit node identity.
children: Vec<Node>Grid children (typically GridItem nodes).
columns: Vec<GridTrack>Column track definitions.
rows: Vec<GridTrack>Row track definitions.
column_gap: Option<f32>Horizontal gap between columns in layout points.
row_gap: Option<f32>Vertical gap between rows in layout points.
padding: [f32; 4]Padding [left, right, top, bottom].
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Grid
impl<'de> Deserialize<'de> for Grid
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Lower for Grid
impl Lower for Grid
Source§fn lower(&self, cx: &mut LoweringContext<'_>) -> NodeId
fn lower(&self, cx: &mut LoweringContext<'_>) -> NodeId
Lower this widget into the IR, returning the root node id.
Auto Trait Implementations§
impl Freeze for Grid
impl !RefUnwindSafe for Grid
impl Send for Grid
impl Sync for Grid
impl Unpin for Grid
impl UnsafeUnpin for Grid
impl !UnwindSafe for Grid
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.