Skip to main content

Box

Struct Box 

Source
pub struct Box {
Show 29 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,
}
Expand description

A set of box-drawing characters. Mirrors rich.box.Box.

The field names match upstream’s 8×4 grid:

top_left    top              top_divider     top_right
head_left   (space)          head_vertical   head_right
head_row_left head_row_horizontal head_row_cross head_row_right
mid_left    (space)          mid_vertical    mid_right
row_left    row_horizontal   row_cross       row_right
foot_row_left foot_row_horizontal foot_row_cross foot_row_right
foot_left   (space)          foot_vertical   foot_right
bottom_left bottom           bottom_divider  bottom_right

Fields§

§top_left: char§top: char§top_divider: char§top_right: char§head_left: char§head_vertical: char§head_right: char§head_row_left: char§head_row_horizontal: char§head_row_cross: char§head_row_right: char§mid_left: char§mid_vertical: char§mid_right: char§row_left: char§row_horizontal: char§row_cross: char§row_right: char§foot_row_left: char§foot_row_horizontal: char§foot_row_cross: char§foot_row_right: char§foot_left: char§foot_vertical: char§foot_right: char§bottom_left: char§bottom: char§bottom_divider: char§bottom_right: char

Implementations§

Source§

impl Box

Source

pub fn get_top(&self, widths: &[usize], edge: bool) -> String

The top border for the given column widths. Port of Box.get_top. edge controls whether the left/right corner glyphs are drawn.

Source

pub fn get_row(&self, widths: &[usize], level: RowLevel, edge: bool) -> String

A horizontal divider row between columns at a given level. Port of Box.get_row. edge controls whether the left/right glyphs are drawn.

Source

pub fn substitute( &self, legacy_windows: bool, safe: bool, ascii_only: bool, ) -> Box

Return a version of this box safe for the target terminal. Port of Box.substitute.

On a legacy Windows console (legacy_windows + safe), the fancy boxes that legacy code pages can’t draw — ROUNDED, HEAVY, HEAVY_HEAD — fall back to SQUARE (DOUBLE/SQUARE/MINIMAL are kept). On a non-UTF-8 terminal (ascii_only), any non-ASCII box becomes ASCII.

Source

pub fn get_bottom(&self, widths: &[usize], edge: bool) -> String

The bottom border for the given column widths. Port of Box.get_bottom. edge controls whether the left/right corner glyphs are drawn.

Trait Implementations§

Source§

impl Clone for Box

Source§

fn clone(&self) -> Box

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Box

Source§

impl Debug for Box

Source§

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

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

impl Eq for Box

Source§

impl PartialEq for Box

Source§

fn eq(&self, other: &Box) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

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 UnsafeUnpin for Box

§

impl UnwindSafe for Box

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.