Skip to main content

Submits

Struct Submits 

Source
pub struct Submits<I> { /* private fields */ }
Expand description

The buttons of an action’s input dialog and input page beside the action’s own, each running the same action with one checkbox of the input checked.

Action::submits and HeaderAction::submits add them, each over a bool field of the input picked off its Keys:

#[derive(FormInput)]
struct Shipping {
    carrier: String,
    notify: bool,
}

fn submits(submits: Submits<Shipping>) -> Submits<Shipping> {
    submits.add("Ship and notify", |f| f.notify)
}

The dialog renders no control for a checkbox a submit picks: the action’s own button posts it unchecked, false, and the submit posts it checked, true, so run reads which button ran it off the input. The buttons follow the action’s own in the order they are added, so Enter in a field still runs the action’s own. The POST goes through the action’s route, its policy, can_run and input checks, whichever button sent it.

Mounting refuses a submit picking a field that does not render a checkbox.

Implementations§

Source§

impl<I: FormInput> Submits<I>

Source

pub fn new() -> Self

No button beside the action’s own.

Source

pub fn add( self, label: impl Into<Text>, pick: impl FnOnce(I::Keys) -> I::Field, ) -> Self

Adds a button labelled label that checks the field pick picks off the input’s keys.

Trait Implementations§

Source§

impl<I: FormInput> Default for Submits<I>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<I> Freeze for Submits<I>

§

impl<I> RefUnwindSafe for Submits<I>

§

impl<I> Send for Submits<I>

§

impl<I> Sync for Submits<I>

§

impl<I> Unpin for Submits<I>

§

impl<I> UnsafeUnpin for Submits<I>

§

impl<I> UnwindSafe for Submits<I>

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

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

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

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

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