Skip to main content

FormState

Struct FormState 

Source
pub struct FormState {
Show 13 fields pub title: String, pub status: String, pub priority: String, pub labels: String, pub assignee: String, pub estimate: String, pub cycles: String, pub milestones: String, pub reviewer: String, pub start_date: String, pub due_date: String, pub parent: String, pub focus: FormFocus,
}

Fields§

§title: String§status: String§priority: String§labels: String§assignee: String§estimate: String§cycles: String§milestones: String§reviewer: String§start_date: String§due_date: String§parent: String

The chosen parent’s number, as a string (WP06 / T026).

A String for the same reason assignee is one: the form’s fields are uniformly text, and each is parsed and validated at submit rather than at the keystroke. Empty means no parent, which carries the same meaning as an empty --parent "" on the CLI.

§focus: FormFocus

Implementations§

Source§

impl FormState

Source

pub fn new(default_status: &str) -> Self

Source

pub fn with_default_assignee( default_status: &str, default_assignee: &str, ) -> Self

Source

pub fn from_issue(issue: &Issue) -> Self

This form with every field prefilled from an existing issue — the TUI’s “clone issue” action (tix #1484).

Exactly the fields the form has are carried over, which is exactly the fields creation takes: number, created, commit and History are not creation inputs, so they are not carried. The title is copied verbatim rather than suffixed with “copy”: the user asked for the source’s data, a title is not an identity (numbers are), and inventing a naming convention here would put a string in the user’s issue that no command in this tool produces.

Multivalued fields are filled in the same comma-separated form the submit path parses (labels, cycles, milestones), so a clone submitted unchanged round-trips the source’s values exactly.

Source

pub fn value_of(&self, focus: FormFocus) -> &str

This form’s value for focus, regardless of which field is focused.

focused_value is value_of(self.focus). The indirection exists so the renderer can walk FormFocus::RING and read each field in turn, which is what lets one list drive both the labels and the focus index.

Source

pub fn focused_value(&self) -> &str

Source

pub fn focused_value_mut(&mut self) -> &mut String

Source

pub fn insert_char(&mut self, c: char)

Source

pub fn delete_char(&mut self)

Source

pub fn is_date_focus(&self) -> bool

Whether the focused field is a picker-only date field.

Source

pub fn focused_date_is_complete(&self) -> bool

Whether the focused date field already holds a complete, valid date.

Source

pub fn set_focused_date(&mut self, value: &str)

Overwrite the focused date field (no-op when it isn’t a date field).

Source

pub fn move_focus_next(&mut self)

Source

pub fn move_focus_prev(&mut self)

Trait Implementations§

Source§

impl Clone for FormState

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FormState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.