Skip to main content

tree_table/
table.rs

1use crate::{Options, PartialOptions, Selection, TableGrid};
2
3pub struct Table {
4    pub(crate) grid: TableGrid,
5    pub(crate) opts: Options,
6    pub(crate) sel: Selection,
7}
8
9impl Table {
10    pub fn new(default_row_dim: u64, options: Option<PartialOptions>) -> Self {
11        let mut opts = Options::new();
12        if let Some(mut partial) = options {
13            Self::acr_validate_partial_opts(&mut partial)
14                .expect("Invalid PartialOptions passed to Table::new");
15            opts = Options::merge(opts, partial);
16        }
17        opts.default_row_dim = default_row_dim;
18        Self {
19            grid: TableGrid::new(opts.max_undos.clone()),
20            opts,
21            sel: Selection::new(),
22        }
23    }
24}