Skip to main content

Form

Struct Form 

Source
pub struct Form {
    pub id: u64,
    pub title: String,
    pub submit: String,
    pub destructive: bool,
    pub ready: bool,
    pub error: Option<String>,
    pub from: Option<(Level, String)>,
    pub fields: Vec<(String, String)>,
    pub short: bool,
    pub answers: Vec<String>,
    pub confirm: bool,
    pub tree: Node,
}
Expand description

An action waiting for its arguments: the form the window shows for what the invocation still needs. The app derives its fields from the action’s parameters (each control from the parameter’s type), keeps what the person typed as their lens state, and checks each value as the action takes it; the window presents the fields (a sheet over the window, a popover at the control it came from, a sheet from the foot of a narrow window) with the title, submit and cancel, and reports edits by field.

Fields§

§id: u64

Which form: edits and answers name it, so ones for a form that closed are dropped.

§title: String

The action, as its label names it (“Share…”).

§submit: String

The submit button’s label: the action’s label without its ellipsis (“Share”).

§destructive: bool

The action takes something away: the submit button is destructive.

§ready: bool

Every argument parses as its type: submit can be taken.

§error: Option<String>

Why the action refused the last submit, when that names no field.

§from: Option<(Level, String)>

The control that ran the action, by level and key: a popover form is anchored to it.

§fields: Vec<(String, String)>

Each field’s control in tree by key, in order, with the text it holds now (what the person typed, else the default): the window shows it when the form opens.

§short: bool

Every field is short (one line, a switch or a choice): a popover can hold them.

§answers: Vec<String>

The controls whose choice answers the form by itself, by key: a form’s quick choices, where a pick says everything the form asks, so one tap is one answer.

§confirm: bool

Offer the submit button: a form whose quick choices answer it needs none until the person is on the way in by hand, so its footer stands as Cancel alone.

§tree: Node

The fields, laid out: a tree of the same components and content nodes views send.

Trait Implementations§

Source§

impl Clone for Form

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 Form

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Form

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Form

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Form

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Form

Auto Trait Implementations§

§

impl Forget for Form

§

impl Freeze for Form

§

impl Move for Form

§

impl RefUnwindSafe for Form

§

impl Send for Form
where RawVecInner: Send, NodeRef<Owned, String, Value, LeafOrInternal>: Send, BoxRaw<(String, Value)>: Send, NodeRef<Owned, String, Event, LeafOrInternal>: Send, BoxRaw<(String, Event)>: Send,

§

impl Sync for Form
where RawVecInner: Sync, NodeRef<Owned, String, Value, LeafOrInternal>: Sync, BoxRaw<(String, Value)>: Sync, NodeRef<Owned, String, Event, LeafOrInternal>: Sync, BoxRaw<(String, Event)>: Sync,

§

impl Unpin for Form
where *const u8 is !null: Unpin, *const LeafNode<String, Value> is !null: Unpin, Box<(String, Value)>: Unpin, *const LeafNode<String, Event> is !null: Unpin, Box<(String, Event)>: Unpin,

§

impl UnsafeUnpin for Form

§

impl UnwindSafe for Form

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more