1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//! Traits for derive macro integration.
//!
//! These traits are implemented by the `#[derive(Tabular)]` and `#[derive(TabularRow)]`
//! macros to enable type-safe tabular formatting.
use TabularSpec;
/// Trait for types that can generate a `TabularSpec`.
///
/// This trait is automatically implemented by `#[derive(Tabular)]`.
///
/// # Example
///
/// ```ignore
/// use standout_render::tabular::{Tabular, TabularSpec};
/// use serde::Serialize;
///
/// #[derive(Serialize, Tabular)]
/// struct Task {
/// #[col(width = 8, style = "muted")]
/// id: String,
///
/// #[col(width = "fill")]
/// title: String,
///
/// #[col(width = 12, align = "right")]
/// status: String,
/// }
///
/// // Use the generated spec
/// let spec = Task::tabular_spec();
/// ```
/// Trait for types that can be converted to a row of strings.
///
/// This trait is automatically implemented by `#[derive(TabularRow)]`.
/// It provides optimized row extraction without JSON serialization.
///
/// # Example
///
/// ```ignore
/// use standout_render::tabular::TabularRow;
///
/// #[derive(TabularRow)]
/// struct Task {
/// id: String,
/// title: String,
/// status: String,
/// }
///
/// let task = Task {
/// id: "TSK-001".to_string(),
/// title: "Implement feature".to_string(),
/// status: "pending".to_string(),
/// };
///
/// let row: Vec<String> = task.to_row();
/// assert_eq!(row, vec!["TSK-001", "Implement feature", "pending"]);
/// ```
/// Trait for types that implement Display.
/// Trait for Option types.