Skip to main content

comfy_table/style/
table.rs

1/// Specify how comfy_table should arrange the content in your table.
2///
3/// ```
4/// use comfy_table::{ContentArrangement, Table};
5///
6/// let mut table = Table::new();
7/// table.set_content_arrangement(ContentArrangement::Dynamic);
8/// ```
9#[derive(Clone, Debug)]
10pub enum ContentArrangement {
11    /// Don't do any content arrangement.\
12    /// Tables with this mode might become wider than your output and look ugly.\
13    /// Constraints on columns are still respected.
14    Disabled,
15    /// Dynamically determine the width of columns in regard to terminal width and content length.\
16    /// With this mode, the content in cells will wrap dynamically to get the best column layout
17    /// for the given content.\
18    /// Constraints on columns are still respected.
19    ///
20    /// **Warning:** If terminal width cannot be determined and no table_width is set via
21    /// [Table::set_width](crate::table::Table::set_width),
22    /// this option won't work and [Disabled](ContentArrangement::Disabled) will be used as a
23    /// fallback.
24    Dynamic,
25    /// This is mode is the same as the [ContentArrangement::Dynamic] arrangement, but it will
26    /// always use as much space as it's given. Any surplus space will be distributed between
27    /// all columns.
28    DynamicFullWidth,
29}