pub struct Box {Show 30 fields
pub top_left: char,
pub top: char,
pub top_divider: char,
pub top_right: char,
pub head_left: char,
pub head_vertical: char,
pub head_right: char,
pub head_row_left: char,
pub head_row_horizontal: char,
pub head_row_cross: char,
pub head_row_right: char,
pub mid_left: char,
pub mid_vertical: char,
pub mid_right: char,
pub row_left: char,
pub row_horizontal: char,
pub row_cross: char,
pub row_right: char,
pub foot_row_left: char,
pub foot_row_horizontal: char,
pub foot_row_cross: char,
pub foot_row_right: char,
pub foot_left: char,
pub foot_vertical: char,
pub foot_right: char,
pub bottom_left: char,
pub bottom: char,
pub bottom_divider: char,
pub bottom_right: char,
pub ascii: bool,
}Expand description
A complete set of box-drawing characters for creating borders and tables.
The structure contains 32 characters arranged in 8 logical rows:
top: Top border (corners and dividers)head: Header content row (vertical lines)head_row: Header separator rowmid: Mid content row (vertical lines)row: Body row separatorfoot_row: Footer separator rowfoot: Footer content row (vertical lines)bottom: Bottom border (corners and dividers)
Fields§
§top_left: charTop-left corner character.
top: charTop horizontal line character.
top_divider: charTop divider (T-junction pointing down).
top_right: charTop-right corner character.
head_left: charLeft edge of header row.
head_vertical: charVertical divider in header.
head_right: charRight edge of header row.
head_row_left: charLeft edge of head row separator.
head_row_horizontal: charHorizontal line in head row separator.
head_row_cross: charCross junction in head row separator.
head_row_right: charRight edge of head row separator.
mid_left: charLeft edge of mid content row.
mid_vertical: charVertical divider in mid section.
mid_right: charRight edge of mid content row.
row_left: charLeft edge of row separator.
row_horizontal: charHorizontal line in row separator.
row_cross: charCross junction in row separator.
row_right: charRight edge of row separator.
foot_row_left: charLeft edge of foot row separator.
foot_row_horizontal: charHorizontal line in foot row separator.
foot_row_cross: charCross junction in foot row separator.
foot_row_right: charRight edge of foot row separator.
foot_left: charLeft edge of footer row.
foot_vertical: charVertical divider in footer.
foot_right: charRight edge of footer row.
bottom_left: charBottom-left corner character.
bottom: charBottom horizontal line character.
bottom_divider: charBottom divider (T-junction pointing up).
bottom_right: charBottom-right corner character.
ascii: boolWhether this box uses ASCII characters only.
Implementations§
Source§impl Box
impl Box
Sourcepub fn substitute(&self, legacy_windows: bool, ascii_only: bool) -> Box
pub fn substitute(&self, legacy_windows: bool, ascii_only: bool) -> Box
Substitute this box for another if it won’t render due to platform issues.
§Arguments
legacy_windows- If true, substitute boxes that don’t render well with legacy Windows console (raster fonts).ascii_only- If true, substitute non-ASCII boxes with ASCII equivalent.
§Returns
A compatible Box. For known box constants that need substitution, returns
the appropriate fallback. For custom boxes, returns self unchanged unless
ascii_only is true and self.ascii is false, in which case returns ASCII.
Sourcepub fn get_plain_headed_box(&self) -> Box
pub fn get_plain_headed_box(&self) -> Box
If this box uses special characters for the header borders, return the equivalent box without special header characters.
§Returns
The equivalent plain-headed Box, or self if already plain.
For custom boxes, returns self unchanged.
Sourcepub fn get_row(&self, widths: &[usize], level: RowLevel, edge: bool) -> String
pub fn get_row(&self, widths: &[usize], level: RowLevel, edge: bool) -> String
Generate a row separator line.
§Arguments
widths- Slice of column widths.level- The type of row separator (Head, Row, Foot, or Mid).edge- Whether to include edge characters (left and right borders).
§Returns
A string representing the row separator.
§Example
use rich_rs::r#box::{SQUARE, RowLevel};
let row = SQUARE.get_row(&[5, 10], RowLevel::Head, true);
assert_eq!(row, "├─────┼──────────┤");Sourcepub fn get_bottom(&self, widths: &[usize]) -> String
pub fn get_bottom(&self, widths: &[usize]) -> String
Sourcepub fn bottom_edge(&self, width: usize) -> String
pub fn bottom_edge(&self, width: usize) -> String
Trait Implementations§
impl Copy for Box
impl Eq for Box
impl StructuralPartialEq for Box
Auto Trait Implementations§
impl Freeze for Box
impl RefUnwindSafe for Box
impl Send for Box
impl Sync for Box
impl Unpin for Box
impl UnwindSafe for Box
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.