header

Macro header 

Source
macro_rules! header {
    ($text:tt) => { ... };
    ($text:tt,$priority:tt) => { ... };
}
Expand description

header defines a crate::SafeGridHeader for use with the crate::TTYGrid.

It is variadic and composes of two current options:

  • text by itself as the first position will yield a base header with the text set.
  • a second parameter, optionally provided, will set the priority to a usize. This controls display capabilities where the terminal width is too small to display all columns. See crate::grid! for more.

Examples:

   use ttygrid::header;

   assert_eq!(header!("header").borrow().text(), "header");

   let priority_header = header!("header2", 10);
   assert_eq!(priority_header.borrow().text(), "header2");
   assert_eq!(priority_header.borrow().priority(), 10);

   let name = "foo";
   let priority = 20;
   assert_eq!(header!(name, priority), header!("foo", 20));