Struct Boxy

Source
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,
}

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: usize

Implementations§

Source§

impl Boxy

Source

pub fn new(box_type: BoxType, box_color: &str) -> Self

Retuns a new instance of the Boxy struct with specified border type and colour

Source

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.

Source

pub fn add_text_line_indx(&mut self, data_string: &str, seg_index: usize)

Adds a new text line to the segemnt with a specific index.

Source

pub fn add_text_line(&mut self, data_string: &str)

Adds a new text line to the latest segment.

Source

pub fn set_align(&mut self, align: BoxAlign)

Sets the aligment of the text in the textbox.

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

pub fn display(&mut self)

Prints/Displays the textbox into the CLI

Trait Implementations§

Source§

impl Debug for Boxy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Boxy

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Boxy

§

impl RefUnwindSafe for Boxy

§

impl Send for Boxy

§

impl Sync for Boxy

§

impl Unpin for Boxy

§

impl UnwindSafe for Boxy

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.