[][src]Struct comfy_table::styling::table::TableStyle

pub struct TableStyle { /* fields omitted */ }

This struct wraps the various styling options for a table The default style preset when using ::new is the ASCII_FULL

Methods

impl TableStyle[src]

pub fn new() -> Self[src]

Create a new TableStyle. The default style is ASCII_FULL,

pub fn load_preset(&mut self, preset: &str)[src]

This function creates a TableStyle from a given preset string. Preset strings can be found in styling::presets::*

Anyway, you can write your own preset strings and use them with this function. The function expects a characters for components to be in the same order as in the Component enum.

If the string isn't long enough, the default ASCII_FULL style will be used for all remaining components.

If the string is too long, remaining charaacters will be simply ignored.

pub fn apply_modifier(&mut self, modifier: &str) -> &mut Self[src]

Modify a preset with a modifier string from modifiers. For instance, the UTF8_ROUND_CORNERS modifies all corners to be round UTF8 box corners.

pub fn set_style(
    &mut self,
    component: Component,
    character: Option<char>
) -> &mut Self
[src]

Define the char that will be used to draw a specific component Look at Component to see all stylable Components

If None is supplied, the element won't be displayed. In case of a e.g. *BorderIntersection a whitespace will be used as placeholder, unless related borders and and corners are set to None as well.

For example, if TopBorderIntersections is None the first row would look like this:

+------ ------+
| asdf | ghij |

If in addition TopLeftCorner,TopBorder and TopRightCorner would be None as well, the first line wouldn't be displayed at all.

pub fn get_style(&mut self, component: Component) -> Option<char>[src]

Get a copy of the char currently used for drawing a specific component

pub fn style_or_default(&self, component: Component) -> String[src]

pub fn style_exists(&self, component: Component) -> bool[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.