API at a glance
The full reference, generated by cargo doc with every feature on, is the
API reference. This page lists the whole
public surface in one place.
pub enum Key { Char(char), Ctrl(char), Alt(char), Tab, BackTab, Enter, Esc, Backspace, Left, Right, Up, Down, Other } // non_exhaustive Key::from(crossterm::event::KeyEvent) // feature "crossterm"pub struct Styles { accent, muted, rule } // Styles::new().accent(..).muted(..).rule(..)Section::new(name).short(short)Section::spans(&[(text, Style)]).short(short) // one label in several stylesSection::spans(..).short_spans(&[(text, Style)]) // the abbreviation in several styles section.name(), short_name() section.set_name(..), set_spans(..), set_short(..), set_short_spans(..)Group::new(name).short(short).section(section) group.name(), short_name(), sections()Nav::new(groups).keys(NavKeys) groups(), place() -> Place { group, section, number } // number is 1-based, 0 when empty selected(group) -> Option<usize> // the section a group remembers section(), section_mut(group, section) -> Option<&mut Section> count(), go(number), go_to(group, section), cycle(by), step(by) open(title, selected), back() -> Option<usize>, close() -> Option<usize> depth(), title(), crumbs(), breadcrumb() -> String action(Key) -> Option<Action>, apply(Action) -> Option<Step>, key(Key) -> Option<Step> bar() -> NavBar, breadcrumb_bar() -> Breadcrumbpub enum Action { NextGroup, PrevGroup, NextSection, PrevSection, Go(usize), Back, Swallow } // non_exhaustivepub enum Step { Moved(Place), Back { selected }, Swallowed } // non_exhaustiveNavKeys { next_group, prev_group, next_section, prev_section, back: &'static [Key], digits, swallow_digits } // non_exhaustive NavKeys::HEY (the default), NavKeys::NONE .next_group(..) .prev_group(..) .next_section(..) .prev_section(..) .back(..) // const builders .digits(bool) .swallow_digits(bool)NavBar::new(&nav).styles(..).lit(bool).groups(bool).underline(bool); height(), hit(..)Breadcrumb::new(&nav).styles(..).centred(bool)Fact::new(text, style)pub enum Drill { Replace, Rows } // Replace by default; non_exhaustiveHeader::new(&nav).styles(..).title(..).left(..).right(..).tabs(bool).lit(bool) .left_parts(&[Fact]).right_parts(&[Fact]) .left_pairs(&[(String, Style)]).right_pairs(&[(String, Style)]).facts_pairs(&[(String, Style)]) .underline(bool).facts(&[Fact]).facts_rule(bool).separator(..).crumbs(bool) .closing(bool).notice(Option<Fact>).drill(Drill); height(), hit(..)Header, NavBar and Breadcrumb are ratatui widgets, drawn by value or by
reference with frame.render_widget.
Key, Action, Step, Drill and NavKeys are #[non_exhaustive]: match
them with a wildcard arm, and build a NavKeys from HEY or NONE and its
methods, so a later release can add to them in a minor version.
The crate reads no files, writes none and prints nothing; its only contract is this API. Each guide shows a part of it at work: groups and sections, keys, fitting, drill-in, rows, styled sections and clicks.