tabled/settings/
mod.rs

1//! Module contains various table configuration settings.
2//!
3//! There 2 types of settings;
4//!
5//! - [`CellOption`] which can modify only a cell.
6//! - [`TableOption`] which can modify table as a whole.
7//!
8//! [`CellOption`] works on behave of [`Modify`] which is actually a [`TableOption`].
9//!
10//! Notice that it's possible to combine settings together by the help of [`Settings`].
11//!
12#![cfg_attr(feature = "std", doc = "```")]
13#![cfg_attr(not(feature = "std"), doc = "```ignore")]
14//! use tabled::{Table, settings::{Settings, Style, Padding}};
15//!
16//! let table_config = Settings::default()
17//!     .with(Padding::new(2, 2, 1, 1))
18//!     .with(Style::rounded());
19//!
20//! let data = [[2023;9]; 3];
21//!
22//! let table = Table::new(data).with(table_config).to_string();
23//!
24//! assert_eq!(
25//!     table,
26//!     "╭────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────╮\n\
27//!      │        │        │        │        │        │        │        │        │        │\n\
28//!      │  0     │  1     │  2     │  3     │  4     │  5     │  6     │  7     │  8     │\n\
29//!      │        │        │        │        │        │        │        │        │        │\n\
30//!      ├────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┼────────┤\n\
31//!      │        │        │        │        │        │        │        │        │        │\n\
32//!      │  2023  │  2023  │  2023  │  2023  │  2023  │  2023  │  2023  │  2023  │  2023  │\n\
33//!      │        │        │        │        │        │        │        │        │        │\n\
34//!      │        │        │        │        │        │        │        │        │        │\n\
35//!      │  2023  │  2023  │  2023  │  2023  │  2023  │  2023  │  2023  │  2023  │  2023  │\n\
36//!      │        │        │        │        │        │        │        │        │        │\n\
37//!      │        │        │        │        │        │        │        │        │        │\n\
38//!      │  2023  │  2023  │  2023  │  2023  │  2023  │  2023  │  2023  │  2023  │  2023  │\n\
39//!      │        │        │        │        │        │        │        │        │        │\n\
40//!      ╰────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────╯"
41//! )
42//! ```
43
44mod cell_option;
45mod settings_list;
46mod table_option;
47
48mod alignment;
49mod extract;
50mod margin;
51mod margin_color;
52mod padding;
53mod padding_color;
54mod reverse;
55mod rotate;
56
57#[cfg(feature = "std")]
58mod modify;
59
60#[cfg(feature = "std")]
61mod color;
62#[cfg(feature = "std")]
63mod concat;
64#[cfg(feature = "std")]
65mod duplicate;
66
67pub mod style;
68
69#[cfg(feature = "std")]
70#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
71pub mod object;
72
73#[cfg(feature = "std")]
74#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
75pub mod disable;
76#[cfg(feature = "std")]
77#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
78pub mod format;
79#[cfg(feature = "std")]
80#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
81pub mod formatting;
82#[cfg(feature = "std")]
83#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
84pub mod height;
85#[cfg(feature = "std")]
86#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
87pub mod highlight;
88#[cfg(feature = "std")]
89#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
90pub mod location;
91#[cfg(feature = "std")]
92#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
93pub mod measurement;
94#[cfg(feature = "std")]
95#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
96pub mod merge;
97#[cfg(feature = "std")]
98#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
99pub mod padding_expand;
100#[cfg(feature = "std")]
101#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
102pub mod panel;
103#[cfg(feature = "std")]
104#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
105pub mod peaker;
106#[cfg(feature = "std")]
107#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
108mod shadow;
109#[cfg(feature = "std")]
110#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
111pub mod span;
112#[cfg(feature = "std")]
113#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
114pub mod split;
115#[cfg(feature = "std")]
116#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
117pub mod themes;
118#[cfg(feature = "std")]
119#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
120pub mod width;
121
122pub use cell_option::CellOption;
123pub use settings_list::{EmptySettings, Settings};
124pub use table_option::TableOption;
125
126pub use self::{
127    alignment::Alignment, extract::Extract, margin::Margin, margin_color::MarginColor,
128    padding::Padding, padding_color::PaddingColor, reverse::Reverse, rotate::Rotate, style::Border,
129    style::Style,
130};
131
132#[cfg(feature = "std")]
133#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
134pub use self::{
135    color::Color,
136    concat::Concat,
137    disable::Remove,
138    duplicate::Dup,
139    format::Format,
140    height::Height,
141    highlight::Highlight,
142    merge::Merge,
143    modify::{Modify, ModifyList},
144    panel::Panel,
145    shadow::Shadow,
146    span::Span,
147    themes::Theme,
148    width::Width,
149};