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 possble 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 | |
44 | mod cell_option; |
45 | mod settings_list; |
46 | mod table_option; |
47 | |
48 | #[cfg (feature = "std" )] |
49 | #[cfg_attr (docsrs, doc(cfg(feature = "std" )))] |
50 | pub mod object; |
51 | |
52 | #[cfg (feature = "std" )] |
53 | mod modify; |
54 | |
55 | mod alignment; |
56 | mod extract; |
57 | mod margin; |
58 | mod padding; |
59 | mod rotate; |
60 | |
61 | #[cfg (feature = "std" )] |
62 | mod color; |
63 | #[cfg (feature = "std" )] |
64 | mod concat; |
65 | #[cfg (feature = "std" )] |
66 | mod duplicate; |
67 | |
68 | pub mod style; |
69 | |
70 | #[cfg (feature = "std" )] |
71 | #[cfg_attr (docsrs, doc(cfg(feature = "std" )))] |
72 | pub mod disable; |
73 | #[cfg (feature = "std" )] |
74 | #[cfg_attr (docsrs, doc(cfg(feature = "std" )))] |
75 | pub mod format; |
76 | #[cfg (feature = "std" )] |
77 | #[cfg_attr (docsrs, doc(cfg(feature = "std" )))] |
78 | pub mod formatting; |
79 | #[cfg (feature = "std" )] |
80 | #[cfg_attr (docsrs, doc(cfg(feature = "std" )))] |
81 | pub mod height; |
82 | #[cfg (feature = "std" )] |
83 | #[cfg_attr (docsrs, doc(cfg(feature = "std" )))] |
84 | pub mod highlight; |
85 | #[cfg (feature = "std" )] |
86 | #[cfg_attr (docsrs, doc(cfg(feature = "std" )))] |
87 | pub mod locator; |
88 | #[cfg (feature = "std" )] |
89 | #[cfg_attr (docsrs, doc(cfg(feature = "std" )))] |
90 | pub mod measurement; |
91 | #[cfg (feature = "std" )] |
92 | #[cfg_attr (docsrs, doc(cfg(feature = "std" )))] |
93 | pub mod merge; |
94 | #[cfg (feature = "std" )] |
95 | #[cfg_attr (docsrs, doc(cfg(feature = "std" )))] |
96 | pub mod panel; |
97 | #[cfg (feature = "std" )] |
98 | #[cfg_attr (docsrs, doc(cfg(feature = "std" )))] |
99 | pub mod peaker; |
100 | #[cfg (feature = "std" )] |
101 | #[cfg_attr (docsrs, doc(cfg(feature = "std" )))] |
102 | mod shadow; |
103 | #[cfg (feature = "std" )] |
104 | #[cfg_attr (docsrs, doc(cfg(feature = "std" )))] |
105 | pub mod span; |
106 | #[cfg (feature = "std" )] |
107 | #[cfg_attr (docsrs, doc(cfg(feature = "std" )))] |
108 | pub mod split; |
109 | #[cfg (feature = "std" )] |
110 | #[cfg_attr (docsrs, doc(cfg(feature = "std" )))] |
111 | pub mod themes; |
112 | #[cfg (feature = "std" )] |
113 | #[cfg_attr (docsrs, doc(cfg(feature = "std" )))] |
114 | pub mod width; |
115 | |
116 | pub use cell_option::CellOption; |
117 | pub use settings_list::{EmptySettings, Settings}; |
118 | pub use table_option::TableOption; |
119 | |
120 | #[cfg (feature = "std" )] |
121 | #[cfg_attr (docsrs, doc(cfg(feature = "std" )))] |
122 | pub use modify::{Modify, ModifyList}; |
123 | |
124 | pub use self::{ |
125 | alignment::Alignment, extract::Extract, margin::Margin, padding::Padding, rotate::Rotate, |
126 | style::Style, |
127 | }; |
128 | |
129 | #[cfg (feature = "std" )] |
130 | #[cfg_attr (docsrs, doc(cfg(feature = "std" )))] |
131 | pub use self::{ |
132 | color::Color, concat::Concat, disable::Disable, duplicate::Dup, format::Format, height::Height, |
133 | highlight::Highlight, merge::Merge, panel::Panel, shadow::Shadow, span::Span, style::Border, |
134 | width::Width, |
135 | }; |
136 | |