pub struct Form {
pub verdict: Verdict,
pub fields: Vec<Field>,
pub json: Option<String>,
pub selected: usize,
pub cursor: usize,
pub error: Option<String>,
}Fields§
§verdict: Verdict§fields: Vec<Field>§json: Option<String>Owner fields as JSON text from $EDITOR; once set it replaces fields.
selected: usize§cursor: usizeUTF-8 byte boundary of the in-terminal JSON cursor; standalone editor is unchanged.
error: Option<String>The last local or human::submit error.
Implementations§
Source§impl Form
impl Form
Sourcepub fn new(verdict: Verdict, schema: Option<&Value>) -> Self
pub fn new(verdict: Verdict, schema: Option<&Value>) -> Self
A form for a flat owner schema (or none); any other schema starts from a JSON template.
Sourcepub fn draft(&self) -> String
pub fn draft(&self) -> String
JSON to open in $EDITOR: the edited text, or the current form values.
Sourcepub fn result(&self) -> Result<Value, String>
pub fn result(&self) -> Result<Value, String>
The complete result: owner fields plus the chosen verdict.
Sourcepub fn set_json(&mut self, text: String)
pub fn set_json(&mut self, text: String)
Replace the JSON text (from $EDITOR or a flat form’s draft); the cursor moves to its end.
Sourcepub fn paste(&mut self, text: &str)
pub fn paste(&mut self, text: &str)
Bounded paste follows the existing Human result limit, without splitting UTF-8.
Sourcepub fn inline_key(&mut self, key: Key, modified: bool)
pub fn inline_key(&mut self, key: Key, modified: bool)
Multiline editing stays inside monitor. Enter inserts a newline, never submits.
pub fn key(&mut self, key: Key)
Trait Implementations§
impl StructuralPartialEq for Form
Auto Trait Implementations§
impl Freeze for Form
impl RefUnwindSafe for Form
impl Send for Form
impl Sync for Form
impl Unpin for Form
impl UnsafeUnpin for Form
impl UnwindSafe for Form
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