| 1 | use superrust-analyzer cargo comfy-table 7.2.2 utils/arrangement/::{ColumnDisplayInforust-analyzer cargo comfy-table 7.2.2 utils/ColumnDisplayInfo#, DisplayInfosrust-analyzer cargo comfy-table 7.2.2 utils/arrangement/DisplayInfos#, constraintrust-analyzer cargo comfy-table 7.2.2 utils/arrangement/constraint/, helperrust-analyzer cargo comfy-table 7.2.2 utils/arrangement/helper/::*}; |
| 2 | use craterust-analyzer cargo comfy-table 7.2.2 crate/::Tablerust-analyzer cargo comfy-table 7.2.2 table/Table#; |
| 3 | |
| 4 | /// Dynamic arrangement is disabled. |
| 5 | /// Apply all non-relative constraints, and set the width of all remaining columns to the |
| 6 | /// respective max content width. |
| 7 | pub fn arrangerust-analyzer cargo comfy-table 7.2.2 utils/arrangement/disabled/arrange().( |
| 8 | table: &Tablerust-analyzer cargo comfy-table 7.2.2 table/Table#, |
| 9 | infos: &mut DisplayInfosrust-analyzer cargo comfy-table 7.2.2 utils/arrangement/DisplayInfos#, |
| 10 | visible_columns: usize, |
| 11 | max_content_widths: &[u16], |
| 12 | ) { |
| 13 | for column in table.columnsrust-analyzer cargo comfy-table 7.2.2 table/Table#columns..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() { |
| 14 | if infos.contains_keyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]contains_key().(&column.indexrust-analyzer cargo comfy-table 7.2.2 column/Column#index.) { |
| 15 | continue; |
| 16 | } |
| 17 | |
| 18 | let mut width = max_content_widths[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().column.indexrust-analyzer cargo comfy-table 7.2.2 column/Column#index.]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().; |
| 19 | |
| 20 | // Reduce the width, if a column has longer content than the specified MaxWidth constraint. |
| 21 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(max_width) = constraintrust-analyzer cargo comfy-table 7.2.2 utils/arrangement/constraint/::maxrust-analyzer cargo comfy-table 7.2.2 utils/arrangement/constraint/max().(table, &column.constraintrust-analyzer cargo comfy-table 7.2.2 column/Column#constraint., visible_columns) |
| 22 | && max_width rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]lt().width |
| 23 | { |
| 24 | width = absolute_width_with_paddingrust-analyzer cargo comfy-table 7.2.2 utils/arrangement/helper/absolute_width_with_padding().(column, max_width); |
| 25 | } |
| 26 | |
| 27 | let info = ColumnDisplayInforust-analyzer cargo comfy-table 7.2.2 utils/ColumnDisplayInfo#::newrust-analyzer cargo comfy-table 7.2.2 utils/impl#[ColumnDisplayInfo]new().(column, width); |
| 28 | infos.insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/btree/map/impl#[`BTreeMap<K, V, A>`]insert().(column.indexrust-analyzer cargo comfy-table 7.2.2 column/Column#index., info); |
| 29 | } |
| 30 | } |