Struct papergrid::config::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>, ) -> Self

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, ) -> Self

This function constructs a cell borders with all sides set.

source

pub const fn empty() -> Self

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

impl<T: Copy> Border<T>

source

pub fn filled(c: T) -> Self

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: Copy> Border<&T>

source

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

Copies the underlying reference to a new border.

source§

impl<T: Clone> Border<&T>

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<T: Clone> Clone for Border<T>

source§

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

Returns a copy 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> Debug for Border<T>

source§

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

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

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

source§

fn default() -> Border<T>

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

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

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 + PartialOrd,

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

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

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

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

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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

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

source§

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

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: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

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

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

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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,

§

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

§

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

§

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.