pub struct App {
pub corpus: PathBuf,
pub responses: Vec<CannedResponse>,
pub entries: Vec<ListEntry>,
pub list_state: ListState,
pub filter: String,
pub focus: Focus,
pub status: String,
pub preview: String,
pub side_panel: String,
pub should_quit: bool,
pub scroll: u16,
}Expand description
Application state for the corpus browser (testable without a real terminal).
Fields§
§corpus: PathBuf§responses: Vec<CannedResponse>§entries: Vec<ListEntry>§list_state: ListState§filter: String§focus: Focus§status: String§preview: String§side_panel: String§should_quit: bool§scroll: u16Implementations§
Source§impl App
impl App
Sourcepub fn load(corpus: PathBuf) -> Result<Self>
pub fn load(corpus: PathBuf) -> Result<Self>
Load corpus from disk and build initial list + selection.
Sourcepub fn rebuild_entries(&mut self)
pub fn rebuild_entries(&mut self)
Apply filter string against id/title/content and refresh selection.
pub fn selected_entry(&self) -> Option<&ListEntry>
pub fn selected_response(&self) -> Option<&CannedResponse>
pub fn select_next(&mut self)
pub fn select_prev(&mut self)
pub fn update_preview(&mut self)
pub fn refresh_side_panel(&mut self)
Sourcepub fn run_check_all(&mut self) -> Result<()>
pub fn run_check_all(&mut self) -> Result<()>
Run quality check over the full (unfiltered) corpus and show the report.
Sourcepub fn run_lint_selected(&mut self) -> Result<()>
pub fn run_lint_selected(&mut self) -> Result<()>
Lint the selected path (or whole corpus) with harper-core.
Sourcepub fn run_convert_selected(&mut self) -> Result<()>
pub fn run_convert_selected(&mut self) -> Result<()>
Convert the selected response with pandoc jira writer into the preview pane.
Sourcepub fn run_reindex(&mut self) -> Result<()>
pub fn run_reindex(&mut self) -> Result<()>
Rebuild the Tantivy index from the published corpus.
Sourcepub fn run_search(&mut self, query: &str) -> Result<()>
pub fn run_search(&mut self, query: &str) -> Result<()>
Search the local index with the current filter (or a fixed query).
Sourcepub fn reload_corpus(&mut self) -> Result<()>
pub fn reload_corpus(&mut self) -> Result<()>
Reload markdown files from disk (after external edits).
Sourcepub fn handle_key(
&mut self,
code: KeyCode,
modifiers: KeyModifiers,
) -> Result<()>
pub fn handle_key( &mut self, code: KeyCode, modifiers: KeyModifiers, ) -> Result<()>
Handle a key press. Returns Ok after mutating state.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for App
impl RefUnwindSafe for App
impl Send for App
impl Sync for App
impl Unpin for App
impl UnsafeUnpin for App
impl UnwindSafe for App
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more