pub struct TTYGrid { /* private fields */ }Expand description
Usually constructed by crate::grid!, this is the outer object of the whole library, all things are held by it in some form. Please review the impl for methods which can be used to adjust the properties of the grid once created.
Implementations§
Source§impl TTYGrid
impl TTYGrid
pub fn new(headers: Vec<SafeGridHeader>) -> Result<Self>
Sourcepub fn set_delimiter_color(&mut self, colors: Colors)
pub fn set_delimiter_color(&mut self, colors: Colors)
Sets the delimiter color; the dashes between the header and the content.
Sourcepub fn set_header_color(&mut self, colors: Colors)
pub fn set_header_color(&mut self, colors: Colors)
Sets the header color.
Sourcepub fn set_primary_color(&mut self, colors: Colors)
pub fn set_primary_color(&mut self, colors: Colors)
Sets the primary color; colors will alternate between primary and secondary per row as the table is built.
Sourcepub fn set_secondary_color(&mut self, colors: Colors)
pub fn set_secondary_color(&mut self, colors: Colors)
Sets the secondary color; colors will alternate between primary and secondary per row as the table is built.
pub fn add_line(&mut self, item: GridLine)
pub fn clear_lines(&mut self)
pub fn headers(&self) -> HeaderList
pub fn select(&mut self, header: SafeGridHeader, idx: usize)
pub fn is_selected(&self, header: SafeGridHeader) -> bool
pub fn select_all_headers(&mut self)
pub fn deselect_all_headers(&mut self)
Sourcepub fn display(&mut self) -> Result<String>
pub fn display(&mut self) -> Result<String>
Yield a string which is suitable for passing to println!, but does not make any attempt
to add terminal styling, which may be better for situations where data is piped. Unlike
std::fmt::Display, this display method returns Result<String, anyhow::Error>.