Expand description
Core abstractions every prompt implements.
A prompt is three small things:
impl Prompt for MyPrompt {
type Output = String;
fn handle(&mut self, key: Key) -> Step<String> { ... }
fn render(&self, ctx: RenderCtx) -> Frame { ... }
fn render_answered(&self, v: &String) -> Frame { ... }
}The generic run function in core::runner owns everything
else: raw mode, the key loop, line-count bookkeeping, the validate
→ success transition, the answered redraw, and Ctrl+C cleanup. Prompts
never touch crossterm or stderr directly.
Structs§
- Render
Ctx - Information the runner hands to
Prompt::renderon every frame.
Enums§
Traits§
- Prompt
- The contract every interactive prompt implements.
Functions§
- run
- Run a prompt to completion.
Type Aliases§
- Frame
- One screen’s worth of prompt output. Each
Stringis exactly one terminal row (newlines are added by the runner). Owning the row split here means the runner can track line counts without re-parsing strings.