pub struct Boxy {Show 13 fields
pub type_enum: BoxType,
pub data: Vec<Vec<String>>,
pub sect_count: usize,
pub box_col: String,
pub colors: Vec<Vec<String>>,
pub int_padding: BoxPad,
pub ext_padding: BoxPad,
pub align: BoxAlign,
pub fixed_width: usize,
pub fixed_height: usize,
pub seg_v_div_count: Vec<usize>,
pub seg_v_div_ratio: Vec<Vec<usize>>,
pub tot_seg: usize,
}Expand description
The main struct. contains all the data rekevant to the TextBox
Fields§
§type_enum: BoxType§data: Vec<Vec<String>>§sect_count: usize§box_col: String§colors: Vec<Vec<String>>§int_padding: BoxPad§ext_padding: BoxPad§align: BoxAlign§fixed_width: usize§fixed_height: usize§seg_v_div_count: Vec<usize>§seg_v_div_ratio: Vec<Vec<usize>>§tot_seg: usizeImplementations§
Source§impl Boxy
impl Boxy
Sourcepub fn new(box_type: BoxType, box_color: &str) -> Self
pub fn new(box_type: BoxType, box_color: &str) -> Self
Retuns a new instance of the Boxy struct with specified border type and colour
pub fn builder() -> BoxyBuilder
Sourcepub fn add_text_sgmt(&mut self, data_string: &str, color: &str)
pub fn add_text_sgmt(&mut self, data_string: &str, color: &str)
Adds a new text segment/section to the textbox, separated by a horizontal divider.
Sourcepub fn add_text_line_indx(
&mut self,
data_string: &str,
color: &str,
seg_index: usize,
)
pub fn add_text_line_indx( &mut self, data_string: &str, color: &str, seg_index: usize, )
Adds a new text line to the segemnt with a specific index.
Sourcepub fn add_text_line(&mut self, data_string: &str, color: &str)
pub fn add_text_line(&mut self, data_string: &str, color: &str)
Adds a new text line to the latest segment.
Sourcepub fn set_int_padding(&mut self, int_padding: BoxPad)
pub fn set_int_padding(&mut self, int_padding: BoxPad)
Set the internal padding for the textbox. (Between border and text)
!! provide a BoxPad Struct for the padding
Sourcepub fn set_ext_padding(&mut self, ext_padding: BoxPad)
pub fn set_ext_padding(&mut self, ext_padding: BoxPad)
Set the external padding for the textbox. (Between terminal limits and border)
!! provide a BoxPad Struct for the padding
Sourcepub fn set_padding(&mut self, ext_padding: BoxPad, int_padding: BoxPad)
pub fn set_padding(&mut self, ext_padding: BoxPad, int_padding: BoxPad)
Set the internal padding and external padding for the textbox.
!! provide a BoxPad Struct for the padding
Sourcepub fn set_width(&mut self, width: usize)
pub fn set_width(&mut self, width: usize)
Sets a fixed width for the textbox insted of dynamically sizing it to the width of the terminal
Sourcepub fn set_height(&mut self, height: usize)
pub fn set_height(&mut self, height: usize)
Sets a fixed height for the textbox. (adds in whitespace above and below the text)
!! This feature is a work in progress. it may not work with the current version of the crate
Sourcepub fn set_segment_ratios(&mut self, seg_index: usize, ratios: Vec<usize>)
pub fn set_segment_ratios(&mut self, seg_index: usize, ratios: Vec<usize>)
Sets the size-ratio between segments when using vertical divisions
!! This feature is a work in progress. it may not work with the current version of the crate