pub enum LayoutOp {
Show 13 variants
Box {
width: Option<f32>,
height: Option<f32>,
min_width: Option<f32>,
max_width: Option<f32>,
min_height: Option<f32>,
max_height: Option<f32>,
padding: [f32; 4],
flex_grow: f32,
flex_shrink: f32,
aspect_ratio: Option<f32>,
},
Flex {
direction: FlexDirection,
wrap: FlexWrap,
flex_grow: f32,
flex_shrink: f32,
padding: [f32; 4],
gap: Option<f32>,
align_items: AlignItems,
justify_content: JustifyContent,
},
Grid {
columns: Vec<GridTrack>,
rows: Vec<GridTrack>,
column_gap: Option<f32>,
row_gap: Option<f32>,
padding: [f32; 4],
},
GridItem {
row_start: GridPlacement,
row_end: GridPlacement,
col_start: GridPlacement,
col_end: GridPlacement,
},
Scroll {
direction: FlexDirection,
show_scrollbar: bool,
width: Option<f32>,
height: Option<f32>,
min_width: Option<f32>,
max_width: Option<f32>,
min_height: Option<f32>,
max_height: Option<f32>,
padding: [f32; 4],
flex_grow: f32,
flex_shrink: f32,
},
Embed {
kind: EmbedKind,
widget_id: WidgetNodeId,
width: Option<f32>,
height: Option<f32>,
},
AbsoluteFill,
Positioned {
left: Option<f32>,
top: Option<f32>,
right: Option<f32>,
bottom: Option<f32>,
width: Option<f32>,
height: Option<f32>,
},
ZStack,
Align,
Flyout {
anchor: NodeId,
content: NodeId,
},
Transform {
transform: [f32; 16],
},
Clip {
path: Option<String>,
},
}Expand description
A layout operation that sizes and positions a node and its children.
LayoutOp covers every layout model in Fission: constrained boxes, flexbox,
CSS Grid, scroll containers, absolute positioning, z-stacking, flyout menus,
transforms, and clipping. Each variant maps to a distinct layout algorithm in
the [fission_layout] crate.
§Padding convention
All padding fields use [left, right, top, bottom] order.
§Flex participation
Variants that have flex_grow and flex_shrink fields participate in flex
layout when placed inside a Flex parent. flex_grow controls how much extra
space the node claims; flex_shrink controls how much it gives up when the
container overflows.
Variants§
Box
A constrained box that sizes itself and stacks its children.
This is the most common layout node. It applies optional fixed dimensions, min/max constraints, padding, and aspect ratio. Children are stacked on top of each other (like a single-child container).
Use Box when you need a container with specific size constraints, padding,
or an aspect ratio, but do not need flex or grid distribution.
Fields
flex_grow: f32How much extra space this node claims when inside a flex container.
0.0 means it does not grow. Default: 0.0.
Flex
A flex container that distributes children along a main axis.
Implements CSS Flexbox semantics: children are measured, flex-grow/shrink is
applied, and then children are positioned according to justify_content and
align_items.
Fields
direction: FlexDirectionalign_items: AlignItemsCross-axis alignment of children. Default: Stretch.
justify_content: JustifyContentMain-axis distribution of children. Default: Start.
Grid
A CSS Grid container that places children into a row/column matrix.
Columns and rows are defined by GridTrack sizing functions. Children are
placed either automatically (in source order) or explicitly via
GridItem.
Fields
GridItem
A child of a Grid that specifies its row/column placement.
If a grid child does not use GridItem, the grid auto-placement algorithm
assigns it the next available cell.
Fields
row_start: GridPlacementWhich row line this item starts at. Default: Auto.
row_end: GridPlacementWhich row line this item ends at. Default: Auto.
col_start: GridPlacementWhich column line this item starts at. Default: Auto.
col_end: GridPlacementWhich column line this item ends at. Default: Auto.
Scroll
A scrollable container.
The scroll container clips its content and shifts it by a scroll offset
obtained from a ScrollDataSource. The layout engine
gives the content infinite space along the scroll axis so it can measure
its natural size.
Fields
direction: FlexDirectionEmbed
A placeholder for a platform-native surface (video, web view, etc.).
The layout engine allocates space for the embed; the platform layer is responsible for creating and positioning the actual native view.
Fields
widget_id: WidgetNodeIdThe widget that owns this native surface.
AbsoluteFill
A child that fills its parent’s entire bounds.
Equivalent to Positioned { left: 0, top: 0, right: 0, bottom: 0 } but
expressed as a zero-field variant for clarity. Commonly used for overlays,
backgrounds, and hit-test areas.
Positioned
A child positioned absolutely within its parent.
At least one of left/right and one of top/bottom should be set.
If both left and right are set (and width is not), the width is
inferred from the parent’s width minus both offsets.
Fields
ZStack
A container that stacks all children on top of each other.
Each child occupies the full size of the stack; later children paint on top of earlier ones. The stack’s own size is the union of its children.
Align
A container that centers its single child within the available space.
Flyout
An anchored popup container (dropdown menu, tooltip, etc.).
The content node is positioned relative to the anchor node’s screen
location, typically directly below it. The layout engine resolves anchor
positions after the main layout pass.
Fields
Transform
Applies a 4x4 affine transform matrix to its child.
The matrix is column-major, matching OpenGL/wgpu convention. The transform does not affect layout; it is applied during painting.
Clip
Clips its child to a rectangular or path-defined region.
If path is None, the clip is the node’s layout rectangle. If path is
set, it is an SVG-style path string.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for LayoutOp
impl<'de> Deserialize<'de> for LayoutOp
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<LayoutOp, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<LayoutOp, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for LayoutOp
impl Serialize for LayoutOp
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for LayoutOp
Auto Trait Implementations§
impl Freeze for LayoutOp
impl RefUnwindSafe for LayoutOp
impl Send for LayoutOp
impl Sync for LayoutOp
impl Unpin for LayoutOp
impl UnsafeUnpin for LayoutOp
impl UnwindSafe for LayoutOp
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
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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.