pub struct BoxChars {
pub top: [char; 4],
pub head: [char; 4],
pub head_row: [char; 4],
pub mid: [char; 4],
pub row: [char; 4],
pub foot_row: [char; 4],
pub foot: [char; 4],
pub bottom: [char; 4],
pub ascii: bool,
}Expand description
Box drawing character set.
Each row is 4 characters: [left, middle, cross/divider, right]
- left: leftmost edge character
- middle: horizontal line character
- cross: intersection or divider character
- right: rightmost edge character
Fields§
§top: [char; 4]Top row: ┌─┬┐
head: [char; 4]Head row (cell content): │ ││
head_row: [char; 4]Head separator: ├─┼┤
mid: [char; 4]Mid separator: ├─┼┤
row: [char; 4]Row separator: ├─┼┤
foot_row: [char; 4]Foot separator: ├─┼┤
foot: [char; 4]Foot row (cell content): │ ││
bottom: [char; 4]Bottom row: └─┴┘
ascii: boolWhether this box uses ASCII-only characters.
Implementations§
Source§impl BoxChars
impl BoxChars
Sourcepub const fn new(
top: [char; 4],
head: [char; 4],
head_row: [char; 4],
mid: [char; 4],
row: [char; 4],
foot_row: [char; 4],
foot: [char; 4],
bottom: [char; 4],
ascii: bool,
) -> Self
pub const fn new( top: [char; 4], head: [char; 4], head_row: [char; 4], mid: [char; 4], row: [char; 4], foot_row: [char; 4], foot: [char; 4], bottom: [char; 4], ascii: bool, ) -> Self
Create a new box from character arrays.
Sourcepub fn get_row_chars(&self, level: RowLevel) -> &[char; 4]
pub fn get_row_chars(&self, level: RowLevel) -> &[char; 4]
Get the row characters for a specific level.
Sourcepub fn build_row(&self, widths: &[usize], level: RowLevel, edge: bool) -> String
pub fn build_row(&self, widths: &[usize], level: RowLevel, edge: bool) -> String
Build a row string for the given column widths.
Sourcepub fn get_bottom(&self, widths: &[usize]) -> String
pub fn get_bottom(&self, widths: &[usize]) -> String
Build the bottom border.
Sourcepub fn get_head_row(&self, widths: &[usize]) -> String
pub fn get_head_row(&self, widths: &[usize]) -> String
Build the header separator.
Sourcepub fn cell_divider(&self) -> char
pub fn cell_divider(&self) -> char
Get the cell divider character.
Sourcepub fn cell_right(&self) -> char
pub fn cell_right(&self) -> char
Get the cell right edge character.
Sourcepub fn substitute(&self, safe: bool) -> &Self
pub fn substitute(&self, safe: bool) -> &Self
Substitute characters for ASCII-safe rendering.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BoxChars
impl RefUnwindSafe for BoxChars
impl Send for BoxChars
impl Sync for BoxChars
impl Unpin for BoxChars
impl UnwindSafe for BoxChars
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