Struct Theme

Source
pub struct Theme { /* private fields */ }
Expand description

A raw style data, which can be produced safely from Style.

It can be useful in order to not have a generics and be able to use it as a variable more conveniently.

Implementations§

Source§

impl Theme

Source

pub const fn new() -> Self

Creates a new empty style.

It’s an analog of Style::empty

Source

pub const fn from_style<T, B, L, R, H, V, const HS: usize, const VS: usize>( style: Style<T, B, L, R, H, V, HS, VS>, ) -> Self

Build a theme out of a style builder.

Source

pub fn set_frame(&mut self, frame: Border<char>)

Returns an outer border of the style.

Source

pub fn set_frame_colors(&mut self, frame: Border<Color>)

Returns an outer border of the style.

Source

pub fn set_borders(&mut self, borders: Borders<char>)

Set borders structure.

Source

pub fn set_colors(&mut self, borders: Borders<Color>)

Set borders structure.

Source

pub const fn get_borders(&self) -> &Borders<char>

Get borders structure.

Source

pub const fn get_borders_colors(&self) -> &Borders<Color>

Get borders color structure.

Source

pub fn get_borders_mut(&mut self) -> &mut Borders<char>

Get borders structure.

Source

pub fn get_colors_mut(&mut self) -> &mut Borders<Color>

Get borders color structure.

Source

pub fn remove_borders(&mut self)

Remove borders.

Source

pub fn remove_colors(&mut self)

Remove colors.

Source

pub fn remove_horizontal_lines(&mut self)

Remove horizontal lines.

Source

pub fn remove_vertical_lines(&mut self)

Remove vertical lines.

Source

pub const fn get_frame(&self) -> Border<char>

Set an outer border.

Source

pub const fn get_frame_colors(&self) -> Border<&Color>

Set an outer border.

Source

pub fn set_horizontal_lines( &mut self, lines: HashMap<usize, HorizontalLine<char>>, )

Set horizontal border lines.

§Example
use std::collections::HashMap;
use tabled::{Table, settings::style::{Style, HorizontalLine}, settings::themes::Theme};

let mut style = Theme::from(Style::re_structured_text());

let mut lines = HashMap::new();
lines.insert(1, HorizontalLine::inherit(Style::extended()).into());

style.set_horizontal_lines(lines);

let data = (0..3).map(|i| ("Hello", i));
let table = Table::new(data).with(style).to_string();

assert_eq!(
    table,
    concat!(
        " ======= ===== \n",
        "  &str    i32  \n",
        "╠═══════╬═════╣\n",
        "  Hello   0    \n",
        "  Hello   1    \n",
        "  Hello   2    \n",
        " ======= ===== ",
    ),
)
Source

pub fn set_vertical_lines(&mut self, lines: HashMap<usize, VerticalLine<char>>)

Set vertical border lines.

§Example
use std::collections::HashMap;
use tabled::{
    Table,
    settings::style::{Style, HorizontalLine},
    settings::themes::Theme,
};


let mut style = Theme::from_style(Style::re_structured_text());

let mut lines = HashMap::new();
lines.insert(1, HorizontalLine::inherit(Style::extended()).into());

style.set_vertical_lines(lines);

let data = (0..3).map(|i| ("Hello", i));
let table = Table::new(data).with(style).to_string();

assert_eq!(
    table,
    concat!(
        "=======╠=====\n",
        " &str  ═ i32 \n",
        "======= =====\n",
        " Hello ═ 0   \n",
        " Hello ═ 1   \n",
        " Hello ═ 2   \n",
        "=======╣=====",
    ),
)
Source

pub fn insert_vertical_line<L>(&mut self, line: usize, vertical: L)
where L: Into<VerticalLine<char>>,

Insert a vertical line into specific column location.

Source

pub fn insert_horizontal_line<L>(&mut self, line: usize, horizontal: L)

Insert a horizontal line to a specific row location.

Source

pub fn get_vertical_line(&self, column: usize) -> Option<&VerticalLine<char>>

Get a vertical line at the row if any set.

Source

pub fn get_horizontal_line(&self, row: usize) -> Option<&HorizontalLine<char>>

Get a horizontal line at the row if any set.

Source

pub const fn borders_has_left(&self) -> bool

Verifies if borders has left line set on the frame.

Source

pub const fn borders_has_right(&self) -> bool

Verifies if borders has right line set on the frame.

Source

pub const fn borders_has_top(&self) -> bool

Verifies if borders has top line set on the frame.

Source

pub const fn borders_has_bottom(&self) -> bool

Verifies if borders has bottom line set on the frame.

Source

pub const fn borders_has_horizontal(&self) -> bool

Verifies if borders has horizontal lines set.

Source

pub const fn borders_has_vertical(&self) -> bool

Verifies if borders has vertical lines set.

Source§

impl Theme

Source

pub fn set_borders_top(&mut self, c: char)

Set a border character top .

Source

pub fn set_borders_bottom(&mut self, c: char)

Set a border character bottom .

Source

pub fn set_borders_left(&mut self, c: char)

Set a border character left .

Source

pub fn set_borders_right(&mut self, c: char)

Set a border character right .

Source

pub fn set_borders_corner_top_left(&mut self, c: char)

Set a border character top left corner .

Source

pub fn set_borders_corner_top_right(&mut self, c: char)

Set a border character top right corner .

Source

pub fn set_borders_corner_bottom_left(&mut self, c: char)

Set a border character bottom left corner .

Source

pub fn set_borders_corner_bottom_right(&mut self, c: char)

Set a border character bottom right corner .

Source

pub fn set_borders_intersection_top(&mut self, c: char)

Set a border character top intersection with a vertical line .

Source

pub fn set_borders_intersection_bottom(&mut self, c: char)

Set a border character bottom intersection with a vertical line .

Source

pub fn set_borders_intersection_left(&mut self, c: char)

Set a border character left intersection with a horizontal line .

Source

pub fn set_borders_intersection_right(&mut self, c: char)

Set a border character right intersection with a horizontal line .

Source

pub fn set_borders_intersection(&mut self, c: char)

Set a border character intersection of horizontal and vertical line .

Source

pub fn set_borders_horizontal(&mut self, c: char)

Set a border character horizontal .

Source

pub fn set_borders_vertical(&mut self, c: char)

Set a border character vertical .

Source§

impl Theme

Source

pub const fn get_borders_top(&self) -> Option<char>

Get a border character top .

Source

pub const fn get_borders_bottom(&self) -> Option<char>

Get a border character bottom .

Source

pub const fn get_borders_left(&self) -> Option<char>

Get a border character left .

Source

pub const fn get_borders_right(&self) -> Option<char>

Get a border character right .

Source

pub const fn get_borders_corner_top_left(&self) -> Option<char>

Get a border character top left corner .

Source

pub const fn get_borders_corner_top_right(&self) -> Option<char>

Get a border character top right corner .

Source

pub const fn get_borders_corner_bottom_left(&self) -> Option<char>

Get a border character bottom left corner .

Source

pub const fn get_borders_corner_bottom_right(&self) -> Option<char>

Get a border character bottom right corner .

Source

pub const fn get_borders_intersection_top(&self) -> Option<char>

Get a border character top intersection with a vertical line .

Source

pub const fn get_borders_intersection_bottom(&self) -> Option<char>

Get a border character bottom intersection with a vertical line .

Source

pub const fn get_borders_intersection_left(&self) -> Option<char>

Get a border character left intersection with a horizontal line .

Source

pub const fn get_borders_intersection_right(&self) -> Option<char>

Get a border character right intersection with a horizontal line .

Source

pub const fn get_borders_intersection(&self) -> Option<char>

Get a border character intersection of horizontal and vertical line .

Source

pub const fn get_borders_horizontal(&self) -> Option<char>

Get a border character horizontal .

Source

pub const fn get_borders_vertical(&self) -> Option<char>

Get a border character vertical .

Source§

impl Theme

Source

pub fn remove_borders_top(&mut self)

Remove a border character top .

Source

pub fn remove_borders_bottom(&mut self)

Remove a border character bottom .

Source

pub fn remove_borders_left(&mut self)

Remove a border character left .

Source

pub fn remove_borders_right(&mut self)

Remove a border character right .

Source

pub fn remove_borders_corner_top_left(&mut self)

Remove a border character top left corner .

Source

pub fn remove_borders_corner_top_right(&mut self)

Remove a border character top right corner .

Source

pub fn remove_borders_corner_bottom_left(&mut self)

Remove a border character bottom left corner .

Source

pub fn remove_borders_corner_bottom_right(&mut self)

Remove a border character bottom right corner .

Source

pub fn remove_borders_intersection_top(&mut self)

Remove a border character top intersection with a vertical line .

Source

pub fn remove_borders_intersection_bottom(&mut self)

Remove a border character bottom intersection with a vertical line .

Source

pub fn remove_borders_intersection_left(&mut self)

Remove a border character left intersection with a horizontal line .

Source

pub fn remove_borders_intersection_right(&mut self)

Remove a border character right intersection with a horizontal line .

Source

pub fn remove_borders_intersection(&mut self)

Remove a border character intersection of horizontal and vertical line .

Source

pub fn remove_borders_horizontal(&mut self)

Remove a border character horizontal .

Source

pub fn remove_borders_vertical(&mut self)

Remove a border character vertical .

Source§

impl Theme

Source

pub fn set_colors_top(&mut self, color: Color)

Set a border color top .

Source

pub fn set_colors_bottom(&mut self, color: Color)

Set a border color bottom .

Source

pub fn set_colors_left(&mut self, color: Color)

Set a border color left .

Source

pub fn set_colors_right(&mut self, color: Color)

Set a border color right .

Source

pub fn set_colors_corner_top_left(&mut self, color: Color)

Set a border color top left corner .

Source

pub fn set_colors_corner_top_right(&mut self, color: Color)

Set a border color top right corner .

Source

pub fn set_colors_corner_bottom_left(&mut self, color: Color)

Set a border color bottom left corner .

Source

pub fn set_colors_corner_bottom_right(&mut self, color: Color)

Set a border color bottom right corner .

Source

pub fn set_colors_intersection_top(&mut self, color: Color)

Set a border color top intersection with a vertical line .

Source

pub fn set_colors_intersection_bottom(&mut self, color: Color)

Set a border color bottom intersection with a vertical line .

Source

pub fn set_colors_intersection_left(&mut self, color: Color)

Set a border color left intersection with a horizontal line .

Source

pub fn set_colors_intersection_right(&mut self, color: Color)

Set a border color right intersection with a horizontal line .

Source

pub fn set_colors_intersection(&mut self, color: Color)

Set a border color intersection of horizontal and vertical line .

Source

pub fn set_colors_horizontal(&mut self, color: Color)

Set a border color horizontal .

Source

pub fn set_colors_vertical(&mut self, color: Color)

Set a border color vertical .

Source§

impl Theme

Source

pub fn remove_colors_top(&mut self)

Remove a border color top .

Source

pub fn remove_colors_bottom(&mut self)

Remove a border color bottom .

Source

pub fn remove_colors_left(&mut self)

Remove a border color left .

Source

pub fn remove_colors_right(&mut self)

Remove a border color right .

Source

pub fn remove_colors_corner_top_left(&mut self)

Remove a border color top left corner .

Source

pub fn remove_colors_corner_top_right(&mut self)

Remove a border color top right corner .

Source

pub fn remove_colors_corner_bottom_left(&mut self)

Remove a border color bottom left corner .

Source

pub fn remove_colors_corner_bottom_right(&mut self)

Remove a border color bottom right corner .

Source

pub fn remove_colors_intersection_top(&mut self)

Remove a border color top intersection with a vertical line .

Source

pub fn remove_colors_intersection_bottom(&mut self)

Remove a border color bottom intersection with a vertical line .

Source

pub fn remove_colors_intersection_left(&mut self)

Remove a border color left intersection with a horizontal line .

Source

pub fn remove_colors_intersection_right(&mut self)

Remove a border color right intersection with a horizontal line .

Source

pub fn remove_colors_intersection(&mut self)

Remove a border color intersection of horizontal and vertical line .

Source

pub fn remove_colors_horizontal(&mut self)

Remove a border color horizontal .

Source

pub fn remove_colors_vertical(&mut self)

Remove a border color vertical .

Source§

impl Theme

Source

pub fn get_colors_top(&self) -> Option<&Color>

Get a border color top .

Source

pub fn get_colors_bottom(&self) -> Option<&Color>

Get a border color bottom .

Source

pub fn get_colors_left(&self) -> Option<&Color>

Get a border color left .

Source

pub fn get_colors_right(&self) -> Option<&Color>

Get a border color right .

Source

pub fn get_colors_corner_top_left(&self) -> Option<&Color>

Get a border color top left corner .

Source

pub fn get_colors_corner_top_right(&self) -> Option<&Color>

Get a border color top right corner .

Source

pub fn get_colors_corner_bottom_left(&self) -> Option<&Color>

Get a border color bottom left corner .

Source

pub fn get_colors_corner_bottom_right(&self) -> Option<&Color>

Get a border color bottom right corner .

Source

pub fn get_colors_intersection_top(&self) -> Option<&Color>

Get a border color top intersection with a vertical line .

Source

pub fn get_colors_intersection_bottom(&self) -> Option<&Color>

Get a border color bottom intersection with a vertical line .

Source

pub fn get_colors_intersection_left(&self) -> Option<&Color>

Get a border color left intersection with a horizontal line .

Source

pub fn get_colors_intersection_right(&self) -> Option<&Color>

Get a border color right intersection with a horizontal line .

Source

pub fn get_colors_intersection(&self) -> Option<&Color>

Get a border color intersection of horizontal and vertical line .

Source

pub fn get_colors_horizontal(&self) -> Option<&Color>

Get a border color horizontal .

Source

pub fn get_colors_vertical(&self) -> Option<&Color>

Get a border color vertical .

Trait Implementations§

Source§

impl Clone for Theme

Source§

fn clone(&self) -> Theme

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 Debug for Theme

Source§

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

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

impl Default for Theme

Source§

fn default() -> Self

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

impl From<Borders<char>> for Theme

Source§

fn from(borders: Borders<char>) -> Self

Converts to this type from the input type.
Source§

impl From<ColoredConfig> for Theme

Source§

fn from(cfg: ColoredConfig) -> Self

Converts to this type from the input type.
Source§

impl<T, B, L, R, H, V, const HSIZE: usize, const VSIZE: usize> From<Style<T, B, L, R, H, V, HSIZE, VSIZE>> for Theme

Source§

fn from(style: Style<T, B, L, R, H, V, HSIZE, VSIZE>) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Theme

Source§

fn eq(&self, other: &Theme) -> 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<R, D> TableOption<R, ColoredConfig, D> for Theme

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<R, D> TableOption<R, CompactConfig, D> for Theme

Source§

fn change(self, _: &mut R, cfg: &mut CompactConfig, _: &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<R, D> TableOption<R, CompactMultilineConfig, D> for Theme

Source§

fn change(self, _: &mut R, cfg: &mut CompactMultilineConfig, _: &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 Eq for Theme

Source§

impl StructuralPartialEq for Theme

Auto Trait Implementations§

§

impl Freeze for Theme

§

impl RefUnwindSafe for Theme

§

impl Send for Theme

§

impl Sync for Theme

§

impl Unpin for Theme

§

impl UnwindSafe for Theme

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.