pub struct Builder {
pub state: String,
pub name: String,
pub kind: Kind,
pub instructions: String,
pub yes: String,
pub no: String,
pub options: Vec<(String, String)>,
pub levels: Vec<String>,
pub focus: usize,
pub cursor: usize,
pub message: Option<String>,
pub existing: Vec<String>,
/* private fields */
}Fields§
§state: String§name: String§kind: Kind§instructions: String§yes: String§no: String§options: Vec<(String, String)>§levels: Vec<String>§focus: usize§cursor: usize§message: Option<String>§existing: Vec<String>The names the session already holds, so the form can say what it would overwrite.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn new(state: String, name: &str) -> Self
pub fn new(state: String, name: &str) -> Self
Opens on the first field that still needs an answer: the state if there is none, the name if there is no name, otherwise the type.
Sourcepub fn of_kind(self, kind: Kind) -> Self
pub fn of_kind(self, kind: Kind) -> Self
Open on this type rather than a noul.
This is how a second question of the same type costs nothing to reach: after one is added the form reopens on the type just used, instead of falling back to a noul every time.
Sourcepub fn over(self, existing: Vec<String>) -> Self
pub fn over(self, existing: Vec<String>) -> Self
The names the session already holds; committing over one of them asks first.
Sourcepub fn fields(&self) -> Vec<Field>
pub fn fields(&self) -> Vec<Field>
The focusable fields, in tab order, for the current question type.
pub fn focused(&self) -> Field
pub fn text(&self, field: Field) -> &str
pub fn key(&mut self, key: KeyEvent) -> Outcome
Sourcepub fn delete_row(&mut self)
pub fn delete_row(&mut self)
Ctrl-X: drop the row the cursor is on.
Sourcepub fn preview(&self) -> Value
pub fn preview(&self) -> Value
The question as it would go on the wire right now, incomplete parts included.
Sourcepub fn as_command(&self) -> String
pub fn as_command(&self) -> String
The equivalent one-line command, so builder mode teaches the fast path.
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnsafeUnpin for Builder
impl UnwindSafe for Builder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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