task_row
Task row molecule used by the iteration graph view.
Renders a single task line within a phase: parallel column indicators
(the task’s status icon in its own column, │ in sibling columns), the
task id, an optional [Pn] priority badge, a padded title, the status
badge, and any blocked/blocking indicators.
const TITLE_PAD
const TITLE_PAD: usize = 35;Max display width for task titles in iteration graph rows.
struct Component
pub struct Component<'a>Renders one task row inside a phase block of the iteration graph.
| Field | Type | Description |
|---|---|---|
blocked_by |
&'a [String] | IDs of the tasks that block this one; any blocker turns the icon and badge to blocked. |
col_index |
usize | Parallel column, counted from 0, that holds this task’s icon. |
id_short |
&'a str | Task ID to show; at most 8 characters are shown. |
is_blocking |
bool | Whether the task blocks others, which adds the ! blocking indicator. |
prefix_len |
usize | Highlighted prefix length for this ID and the blocker IDs. |
priority |
Option<u8> | Priority shown as [Pn]; None leaves the badge slot blank. |
priority_pad |
usize | Width of the priority slot, from priority_pad_width; 0 omits the slot. |
status |
&'a str | Task status, which picks the icon, badge and title style. |
title |
&'a str | Task title, cut to 35 characters with … and padded to 35 columns. |
total_cols |
usize | Number of parallel columns in the phase; the others show │. |
Implements Display.
Component::new
pub fn new(
col_index: usize,
total_cols: usize,
id_short: &'a str,
title: &'a str,
status: &'a str,
priority: Option<u8>,
priority_pad: usize,
prefix_len: usize,
blocked_by: &'a [String],
is_blocking: bool,
) -> SelfCreate a task row.
| Parameter | Type | Description |
|---|---|---|
col_index |
usize | the parallel column, counted from 0, that holds this task’s icon |
total_cols |
usize | the number of parallel columns in the phase |
id_short |
&'a str | the task ID |
title |
&'a str | the task title |
status |
&'a str | the task status, such as open or done |
priority |
Option<u8> | the task priority, shown as [Pn] |
priority_pad |
usize | the width of the priority slot, from [priority_pad_width]; 0 omits it |
prefix_len |
usize | the highlighted prefix length for this ID and the blocker IDs |
blocked_by |
&'a [String] | the IDs of the tasks that block this one |
is_blocking |
bool | whether the task blocks other tasks |
| returns | Self | The row, ready to display. |
fn priority_pad_width
pub fn priority_pad_width(priorities: impl IntoIterator<Item = Option<u8>>) -> usizeCompute the column width that fits the widest [Pn] priority badge in a set of tasks.
| Parameter | Type | Description |
|---|---|---|
priorities |
impl IntoIterator<Item = Option<u8>> | the priority of each task; None has no badge |
| returns | usize | The maximum rendered width of a priority badge for the given task priorities, or 0 if none have one. |
fn priority_badge
fn priority_badge(priority: Option<u8>) -> Option<Badge>Build the [Pn] badge for a priority, in the task.list.priority style.
| Parameter | Type | Description |
|---|---|---|
priority |
Option<u8> | the task priority; None has no badge |
| returns | Option<Badge> | The badge, or None when the task has no priority. |