column
Layout atom declaring horizontal space intent within a Row.
struct Component
pub struct ComponentA single cell within a Row that declares how much horizontal space it wants.
Column is a pure layout atom — it does NOT measure or resolve widths. That is the Row molecule’s responsibility. Column only stores the content and the flex intent.
| Field | Type | Description |
|---|---|---|
content |
String | Rendered cell text, which may hold ANSI styling. |
flex |
Flex | How much horizontal space the cell asks the row for. |
Implements Display.
Component::fixed
pub fn fixed(width: usize, content: impl Display) -> SelfCreate a column that requests an exact character width.
| Parameter | Type | Description |
|---|---|---|
width |
usize | the width in columns; the row pads narrower content to it and never cuts wider content |
content |
impl Display | the cell content, rendered to text now |
| returns | Self | The fixed-width column. |
Component::flex
pub fn flex(weight: u32, content: impl Display) -> SelfCreate a column that requests a proportional share of remaining space.
| Parameter | Type | Description |
|---|---|---|
weight |
u32 | the column’s share relative to the other flex columns in the row |
content |
impl Display | the cell content, rendered to text now |
| returns | Self | The flex column. |
Component::natural
pub fn natural(content: impl Display) -> SelfCreate a column that requests exactly enough space for its content.
| Parameter | Type | Description |
|---|---|---|
content |
impl Display | the cell content, rendered to text now |
| returns | Self | The natural-width column. |
Component::content
pub fn content(&self) -> &strReturns the content string.
| Parameter | Type | Description |
|---|---|---|
| returns | &str | The content string. |
Component::flex_intent
pub fn flex_intent(&self) -> FlexReturns the flex intent for this column.
| Parameter | Type | Description |
|---|---|---|
| returns | Flex | The flex intent for this column. |
enum Flex
pub enum FlexHow a column requests horizontal space.
| Variant | Description |
|---|---|
Fixed(usize) |
Requests an exact character width. Narrower content is padded; wider content is not cut. |
Flex(u32) |
Requests a proportional share of remaining space after fixed and natural columns are allocated. |
Natural |
Requests exactly enough space to fit its content. |