pub struct ScheduleForm {
pub editing: Option<String>,
pub fields: Vec<ScheduleField>,
pub values: Vec<String>,
pub focus: usize,
pub error: Option<String>,
}Expand description
The create/edit form the Cycle schedules tab shows (T036).
A page-local form: the page owns it, exactly as it owns the reason prompt, so
defining a schedule needs no new mode, no new InputContext and no new binding.
It collects text and nothing else — every rule about what the text may be is the
shared registry’s, and a refusal keeps the form open with the message on it rather
than closing and losing what was typed.
Fields§
§editing: Option<String>The id being edited, or None when the form creates a new schedule.
fields: Vec<ScheduleField>The fields shown, in row order.
values: Vec<String>The typed value per shown field, in the same order.
focus: usizeThe focused row.
error: Option<String>The refusal the last save produced, kept while the form stays open.
Implementations§
Source§impl ScheduleForm
impl ScheduleForm
Sourcepub fn create() -> Self
pub fn create() -> Self
A form that creates a schedule: every field empty, the id focused first.
Sourcepub fn edit(id: String, values: Vec<String>) -> Self
pub fn edit(id: String, values: Vec<String>) -> Self
A form that edits id, pre-filled from values (in ScheduleField::EDIT
order).
A short or long values is tolerated rather than panicking: the form is a
session value a test can build by hand, and a missing value is an empty field.
Sourcepub fn focused(&self) -> ScheduleField
pub fn focused(&self) -> ScheduleField
The focused field.
Sourcepub fn value(&self, field: ScheduleField) -> &str
pub fn value(&self, field: ScheduleField) -> &str
The typed value of field ("" when the form does not show it).
Sourcepub fn focus_next(&mut self)
pub fn focus_next(&mut self)
Step the focus forward, wrapping.
Sourcepub fn focus_prev(&mut self)
pub fn focus_prev(&mut self)
Step the focus backward, wrapping.
Sourcepub fn insert_char(&mut self, c: char)
pub fn insert_char(&mut self, c: char)
Append a character to the focused field.
Sourcepub fn delete_char(&mut self)
pub fn delete_char(&mut self)
Remove the focused field’s last character.
Sourcepub fn clear_field(&mut self)
pub fn clear_field(&mut self)
Empty the focused field, for a value being replaced rather than extended.
Trait Implementations§
Source§impl Clone for ScheduleForm
impl Clone for ScheduleForm
Source§impl Debug for ScheduleForm
impl Debug for ScheduleForm
impl Eq for ScheduleForm
Source§impl PartialEq for ScheduleForm
impl PartialEq for ScheduleForm
impl StructuralPartialEq for ScheduleForm
Auto Trait Implementations§
impl Freeze for ScheduleForm
impl RefUnwindSafe for ScheduleForm
impl Send for ScheduleForm
impl Sync for ScheduleForm
impl Unpin for ScheduleForm
impl UnsafeUnpin for ScheduleForm
impl UnwindSafe for ScheduleForm
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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