use crate::{ grid::config::ColoredConfig, grid::records::{ExactRecords, Records, RecordsMut, Resizable}, settings::TableOption, }; use super::Panel; /// Header inserts a [`Panel`] at the top. /// See [`Panel`]. #[derive(Debug)] pub struct Header(S); impl Header { /// Creates a new object. pub fn new(text: S) -> Self where S: AsRef, { Self(text) } } impl TableOption for Header where S: AsRef, R: Records + ExactRecords + Resizable + RecordsMut, { fn change(self, records: &mut R, cfg: &mut ColoredConfig, dimension: &mut D) { Panel::horizontal(0, self.0.as_ref()).change(records, cfg, dimension); } }