search_result
Single-hit search result view rendering entity type, ID, title, and optional body.
struct Component
pub struct ComponentA single search hit showing entity type, ID, title, and status/kind.
| Field | Type | Description |
|---|---|---|
body |
Option<String> | Description or body text, shown in full under the hit only when expanded is set. |
entity_type |
EntityType | Kind of entity, which sets the leading label. |
expanded |
bool | Whether to add a dashed header line and the body. |
id |
String | Short ID of the entity, shown with its prefix highlighted. |
prefix_len |
usize | Number of highlighted characters in the ID. |
status_or_kind |
Option<String> | Status shown as a colored badge after the title; None for artifacts. |
title |
String | Entity title, shown unstyled. |
Implements Display.
Component::artifact
pub fn artifact(id: String, title: String, prefix_len: usize) -> SelfCreate a search result for an artifact.
| Parameter | Type | Description |
|---|---|---|
id |
String | the artifact’s short ID |
title |
String | the artifact title |
prefix_len |
usize | the number of highlighted ID characters |
| returns | Self | A collapsed hit with no status and no body. |
Component::iteration
pub fn iteration(id: String, title: String, status: String, prefix_len: usize) -> SelfCreate a search result for an iteration.
| Parameter | Type | Description |
|---|---|---|
id |
String | the iteration’s short ID |
title |
String | the iteration title |
status |
String | the iteration status, shown as a badge |
prefix_len |
usize | the number of highlighted ID characters |
| returns | Self | A collapsed hit with no body. |
Component::task
pub fn task(id: String, title: String, status: String, prefix_len: usize) -> SelfCreate a search result for a task.
| Parameter | Type | Description |
|---|---|---|
id |
String | the task’s short ID |
title |
String | the task title |
status |
String | the task status, shown as a badge |
prefix_len |
usize | the number of highlighted ID characters |
| returns | Self | A collapsed hit with no body. |
Component::body
pub fn body(self, body: Option<String>) -> SelfSet the body/description content shown in expanded mode.
| Parameter | Type | Description |
|---|---|---|
body |
Option<String> | the text to show, or None for none |
| returns | Self | The hit with the body replaced. |
Component::expanded
pub fn expanded(self, expanded: bool) -> SelfEnable expanded rendering with full description and section separator.
| Parameter | Type | Description |
|---|---|---|
expanded |
bool | whether to show the dashed header and the body |
| returns | Self | The hit with the mode set. |
enum EntityType
enum EntityTypeKind of entity a hit is, which sets its leading label and that label’s color.
| Variant | Description |
|---|---|
Artifact |
An artifact, labeled artifact in the status.open style. |
Iteration |
An iteration, labeled iteration in the status.done style. |
Task |
A task, labeled task in the status.in_progress style. |
EntityType::label
fn label(&self) -> &'static strThe lowercase word shown for this kind of entity.
| Parameter | Type | Description |
|---|---|---|
| returns | &'static str | artifact, iteration or task. |
fn status_to_style
fn status_to_style(status: &str) -> StylePick the theme style for a status badge.
| Parameter | Type | Description |
|---|---|---|
status |
&str | a task or iteration status; in_progress and in-progress are both accepted |
| returns | Style | The matching status.* style; an unknown status gets the status.open style. |