Decor

Struct Decor 

Source
pub struct Decor {
Show 15 fields pub lt: char, pub rt: char, pub rb: char, pub lb: char, pub te: char, pub re: char, pub be: char, pub le: char, pub tc: char, pub rc: char, pub bc: char, pub lc: char, pub cross: char, pub sh: char, pub sv: char,
}
Expand description

The box outside the object

It include many char for making a box. But it not include the functions for making box!

As shown in the figure below, the abbreviation is:
l: left, r: right, t: top, b: bottom, e: edge, c: cross

lt    te   tc       rt
  ┌────────┰────────┓          lt: ┌ rt: ┓
  │        ┆        ┃          lb: ╰ rb: ╝
  │        ┆sv      ┃
  │        ┆        ┃          te: ─ re: ┃  sv: ┆
lc├╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌┦rc ┄┄┄┄┄> be: ═ le: │  sh: ╌
  │   cross┆   sh   ┃
le│        ┆        ┃re        tc: ┰ rc: ┦
  │        ┆        ┃          bc: ┸ lc: ├  cross: ┼
  ╰════════┸════════╝
lb        bc   be    rb

In general, you don’t need to manually set up your own. Some useful constructor methods can directly generate specific styles of borders.

Fields§

§lt: char

left top corner

§rt: char

right top corner

§rb: char

right top corner

§lb: char

left bottom corner

§te: char

top edge

§re: char

right edge

§be: char

bottom edge

§le: char

left edge

§tc: char

top cross

§rc: char

right cross

§bc: char

bottom cross

§lc: char

left cross

§cross: char

the cross

§sh: char

horizontal segmetation

§sv: char

vertical segmetation

Implementations§

Source§

impl Decor

Source

pub fn get_corner(&self) -> (char, char, char, char)

Return those corner char

Source

pub fn get_edge(&self) -> (char, char, char, char)

Return those edge char

Source

pub fn get_cross(&self) -> (char, char, char, char, char)

Return those cross char

Source§

impl Decor

Source

pub fn simple() -> Self

The regular style

┌───┬───┐
│   │   │
├───┼───┤
│   │   │
└───┴───┘
Source

pub fn bold() -> Self

The bold style

┏━━━┳━━━┓
┃   ┃   ┃
┣━━━╋━━━┫
┃   ┃   ┃
┗━━━┻━━━┛
Source

pub fn plot() -> Self

The style for plot

╭═══╤═══╗
│   ╎   ║
├┄┄┄┼┄┄┄╢
│   ╎   ║
╰───┴───╜

Auto Trait Implementations§

§

impl Freeze for Decor

§

impl RefUnwindSafe for Decor

§

impl Send for Decor

§

impl Sync for Decor

§

impl Unpin for Decor

§

impl UnwindSafe for Decor

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.