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