pub struct ColumnData {
pub columns: Vec<String>,
}Expand description
Multi-column data for aligned tree formatting
Represents a tree node with multiple columns that should be aligned vertically when rendered. Each column is a separate string value.
§Examples
use tree_fmt::ColumnData;
// Create node with 3 columns: name, version, path
let data = ColumnData::new( vec![
"api_ollama".to_string(),
"v0.1.0".to_string(),
"(api/ollama)".to_string()
]);
assert_eq!( data.columns.len(), 3 );Fields§
§columns: Vec<String>Column values for this node
Implementations§
Source§impl ColumnData
impl ColumnData
Sourcepub fn from_pairs(pairs: Vec<(&str, &str)>) -> Self
pub fn from_pairs(pairs: Vec<(&str, &str)>) -> Self
Create column data from key-value pairs
Only the values are stored, keys are discarded. Useful for self-documenting code when building column data.
§Arguments
pairs- Vector of (key, value) pairs
§Examples
use tree_fmt::ColumnData;
let data = ColumnData::from_pairs( vec![
( "name", "api_ollama" ),
( "version", "v0.1.0" ),
( "path", "(api/ollama)" )
]);
assert_eq!( data.columns.len(), 3 );
assert_eq!( data.columns[ 0 ], "api_ollama" );Trait Implementations§
Source§impl Clone for ColumnData
impl Clone for ColumnData
Source§fn clone(&self) -> ColumnData
fn clone(&self) -> ColumnData
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ColumnData
impl Debug for ColumnData
Auto Trait Implementations§
impl Freeze for ColumnData
impl RefUnwindSafe for ColumnData
impl Send for ColumnData
impl Sync for ColumnData
impl Unpin for ColumnData
impl UnwindSafe for ColumnData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more