cvkg-layout
cvkg-layout provides the flexbox-inspired geometric layout engine for CVKG. It computes positions and sizes for child views within container views.
What This Crate Does
- Implements
HStackfor horizontal layout - Implements
VStackfor vertical layout - Provides
AlignmentandDistributionenums for positioning - Supports flex weight distribution for proportional space allocation
What This Crate Does NOT Do
- Does not provide UI components (see cvkg-components)
- Does not handle rendering (see cvkg-render-gpu)
- Does not maintain state
Public API Overview
Layout Containers
/// Horizontal stack that lays out children side-by-side
/// Vertical stack that lays out children top-to-bottom
Layout Enums
LayoutView Trait
// Implemented by layout containers
Usage Example
use ;
use View;
// Create a horizontal stack with 16px spacing, center aligned
let horizontal = new
.child
.child;
// Create a vertical stack with space-between distribution
let vertical = new
.child
.child;
Known Limitations
- Layout calculations are performed synchronously; very deep hierarchies may impact frame rate
- Flex weight distribution does not support minimum/maximum constraints
- Percentage-based widths are not supported; use
frame()modifier instead