Struct Border

Source
pub struct Border<T> {
    pub top: Option<T>,
    pub bottom: Option<T>,
    pub left: Option<T>,
    pub right: Option<T>,
    pub left_top_corner: Option<T>,
    pub left_bottom_corner: Option<T>,
    pub right_top_corner: Option<T>,
    pub right_bottom_corner: Option<T>,
}
Expand description

Border is a representation of a cells’s borders (left, right, top, bottom, and the corners)

                        top border
                            |
                            V
corner top left ------> +_______+  <---- corner top left
                        |       |
left border ----------> |  cell |  <---- right border
                        |       |
corner bottom right --> +_______+  <---- corner bottom right
                            ^
                            |
                       bottom border

Fields§

§top: Option<T>

A character for a top.

§bottom: Option<T>

A character for a bottom.

§left: Option<T>

A character for a left.

§right: Option<T>

A character for a right.

§left_top_corner: Option<T>

A character for a left top corner.

§left_bottom_corner: Option<T>

A character for a left bottom corner.

§right_top_corner: Option<T>

A character for a right top corner.

§right_bottom_corner: Option<T>

A character for a right bottom corner.

Implementations§

Source§

impl<T> Border<T>

Source

pub const fn new( top: Option<T>, bottom: Option<T>, left: Option<T>, right: Option<T>, left_top_corner: Option<T>, left_bottom_corner: Option<T>, right_top_corner: Option<T>, right_bottom_corner: Option<T>, ) -> Border<T>

This function constructs a cell borders with all sides set.

Source

pub const fn full( top: T, bottom: T, left: T, right: T, top_left: T, top_right: T, bottom_left: T, bottom_right: T, ) -> Border<T>

This function constructs a cell borders with all sides set.

Source

pub const fn empty() -> Border<T>

This function constructs a cell borders with all sides being empty (set off).

Source

pub const fn is_empty(&self) -> bool

Checks whether any side is set.

Source

pub fn is_same(&self) -> bool
where T: PartialEq,

Checks whether all sides are equal to one another.

Source

pub const fn has_top(&self) -> bool

Verifies whether anything is set on the top.

Source

pub const fn has_bottom(&self) -> bool

Verifies whether anything is set on the bottom.

Source

pub const fn has_left(&self) -> bool

Verifies whether anything is set on the left.

Source

pub const fn has_right(&self) -> bool

Verifies whether anything is set on the right.

Source

pub fn map<F, T1>(self, f: F) -> Border<T1>
where F: Fn(T) -> T1,

Converts a border with a given function.

Source§

impl<T> Border<T>
where T: Copy,

Source

pub const fn filled(c: T) -> Border<T>

This function constructs a cell borders with all sides’s char set to a given character.

It behaves like Border::full with the same character set to each side.

Source§

impl<T> Border<&T>
where T: Copy,

Source

pub fn copied(&self) -> Border<T>

Copies the underlying reference to a new border.

Source§

impl<T> Border<&T>
where T: Clone,

Source

pub fn cloned(&self) -> Border<T>

Copies the underlying reference to a new border.

Source§

impl<T> Border<T>

Source

pub fn convert<B>(self) -> Border<B>
where B: From<T>,

Convert all values on the border into another ones.

Trait Implementations§

Source§

impl<R> CellOption<R, ColoredConfig> for Border<char>
where R: Records + ExactRecords,

Source§

fn change(self, records: &mut R, cfg: &mut ColoredConfig, entity: Entity)

Modification function of a certail part of a grid targeted by Entity.
Source§

fn hint_change(&self) -> Option<Entity>

A hint whether an TableOption is going to change table layout. Read more
Source§

impl<T> Clone for Border<T>
where T: Clone,

Source§

fn clone(&self) -> Border<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for Border<T>
where T: Debug,

Source§

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

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

impl<T> Default for Border<T>
where T: Default,

Source§

fn default() -> Border<T>

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

impl<T, B, L, R> From<Border<T, B, L, R>> for Border<char>

Source§

fn from(value: Border<T, B, L, R>) -> Self

Converts to this type from the input type.
Source§

impl From<BorderColor> for Border<Color>

Source§

fn from(value: BorderColor) -> Self

Converts to this type from the input type.
Source§

impl<T> Hash for Border<T>
where T: Hash,

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T> Ord for Border<T>
where T: Ord,

Source§

fn cmp(&self, other: &Border<T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T> PartialEq for Border<T>
where T: PartialEq,

Source§

fn eq(&self, other: &Border<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> PartialOrd for Border<T>
where T: PartialOrd,

Source§

fn partial_cmp(&self, other: &Border<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<R, D> TableOption<R, ColoredConfig, D> for Border<char>

Source§

fn change(self, _: &mut R, cfg: &mut ColoredConfig, _: &mut D)

The function modificaties of records and a grid configuration.
Source§

fn hint_change(&self) -> Option<Entity>

A hint whether an TableOption is going to change table layout. Read more
Source§

impl<T> Copy for Border<T>
where T: Copy,

Source§

impl<T> Eq for Border<T>
where T: Eq,

Source§

impl<T> StructuralPartialEq for Border<T>

Auto Trait Implementations§

§

impl<T> Freeze for Border<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Border<T>
where T: RefUnwindSafe,

§

impl<T> Send for Border<T>
where T: Send,

§

impl<T> Sync for Border<T>
where T: Sync,

§

impl<T> Unpin for Border<T>
where T: Unpin,

§

impl<T> UnwindSafe for Border<T>
where T: UnwindSafe,

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<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.