pub struct App {Show 18 fields
pub state: TextArea<'static>,
pub questions: Vec<QuestionDraft>,
pub selected: usize,
pub focus: Focus,
pub model: Option<String>,
pub models: Vec<String>,
pub calibration: Option<f64>,
pub status: Status,
pub answers: Option<Answers>,
pub stale: bool,
pub answers_scroll: u16,
pub answers_max_scroll: Cell<u16>,
pub editor: Option<Editor>,
pub show_help: bool,
pub url: String,
pub healthy: Option<bool>,
pub should_quit: bool,
pub tick: u64,
/* private fields */
}Fields§
§state: TextArea<'static>§questions: Vec<QuestionDraft>§selected: usizeRanges over 0..=questions.len(): one past the last question is the “add” row.
focus: Focus§model: Option<String>§models: Vec<String>Aliases offered by the service, for cycling with m.
calibration: Option<f64>§status: Status§answers: Option<Answers>§stale: boolWhether answers belongs to an older request than the form now describes.
answers_scroll: u16Lines of the answers pane scrolled past the top.
answers_max_scroll: Cell<u16>How far the answers pane can scroll, as the last draw found it. Only drawing knows how many lines the answers wrap to, so the renderer records it here and scrolling stops there, instead of running on into blank space that then takes as many presses to undo.
editor: Option<Editor>§show_help: bool§url: String§healthy: Option<bool>§should_quit: bool§tick: u64Advances once per tick; drives the spinner.
Implementations§
Source§impl App
impl App
pub fn new(session: Session, url: String) -> Self
pub fn state_text(&self) -> String
pub fn to_session(&self) -> Session
Sourcepub fn on_add_row(&self) -> bool
pub fn on_add_row(&self) -> bool
Whether the cursor is on the “add question” row after the last question.
pub fn select_next(&mut self)
pub fn select_previous(&mut self)
Sourcepub fn add_question(&mut self)
pub fn add_question(&mut self)
Open the editor on a new question, offering an id that does not collide with an
existing one. The field itself starts empty; see Editor::adding.
Sourcepub fn edit_selected(&mut self)
pub fn edit_selected(&mut self)
Edit the selected question, or start a new one when the cursor is on the add row.
pub fn delete_selected(&mut self)
Sourcepub fn commit_editor(&mut self)
pub fn commit_editor(&mut self)
Take the draft out of the editor and put it where it belongs.
pub fn cancel_editor(&mut self)
Sourcepub fn cycle_model(&mut self)
pub fn cycle_model(&mut self)
Step through the service’s aliases, then back to “the server’s default”.
Sourcepub fn build<'a>(&self, client: &'a Client) -> SystemOne<'a>
pub fn build<'a>(&self, client: &'a Client) -> SystemOne<'a>
Assemble the request this form describes. See Session::build.
pub fn is_sending(&self) -> bool
Sourcepub fn begin_send(&mut self) -> u64
pub fn begin_send(&mut self) -> u64
Enter the sending state and return the generation the result must carry to be accepted.
Sourcepub fn finish_send(
&mut self,
generation: u64,
result: Result<Answers, Error>,
) -> bool
pub fn finish_send( &mut self, generation: u64, result: Result<Answers, Error>, ) -> bool
Take a request’s result. Returns whether it was accepted, i.e. whether it belonged to the request currently in flight.
Sourcepub fn answer_order(&self) -> Vec<&str>
pub fn answer_order(&self) -> Vec<&str>
The ids of the answers on screen, in the order their questions were asked.
The response keys its answers by id, which sorts q10 before q2 and team before
urgent. Anything the service answered that was not in the sent list — which a normal
round trip never produces — follows in the response’s order rather than being hidden.
Sourcepub fn scroll_answers(&mut self, lines: i32)
pub fn scroll_answers(&mut self, lines: i32)
Scroll the answers pane by lines, down for positive, within what the last draw allows.
Sourcepub fn question_for(&self, id: &str) -> Option<&str>
pub fn question_for(&self, id: &str) -> Option<&str>
The question text an answer on screen was asked with.
pub fn cancel_send(&mut self)
pub fn failure(&self) -> Option<&Failure>
Sourcepub fn is_blamed(&self, index: usize) -> bool
pub fn is_blamed(&self, index: usize) -> bool
Whether the question at index is the one the service refused.
Sourcepub fn mark_stale(&mut self)
pub fn mark_stale(&mut self)
The form has changed since the answers on screen were produced.
Auto Trait Implementations§
impl !Freeze for App
impl !RefUnwindSafe for App
impl !Sync for App
impl Send 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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§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>
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>
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