Skip to main content

Filling

Struct Filling 

Source
pub struct Filling<'a> {
    pub value: Value<'a>,
    pub trailing: Option<Markup<'a>>,
    pub control_attrs: Option<Markup<'a>>,
    pub id_prefix: Option<&'a str>,
}
Expand description

Everything about the field that the description does not carry.

Fields§

§value: Value<'a>

What the field holds now.

§trailing: Option<Markup<'a>>

Markup appended inside the group, after the hint. Not escaped.

§control_attrs: Option<Markup<'a>>

Attributes written onto the control element itself. Not escaped.

trailing’s argument at attribute scale: a host knows facts about the control that no description layer carries, and until this existed the only way to attach one was to stop calling this emitter and write a second one. quasi’s suggestion source is the first caller — a field that owns a list of candidates is a role="combobox" pointing at the list it owns, and neither half is anything makeover_layout::Field can say.

Written verbatim, so a caller supplies attr="value" pairs with no leading space and does its own escaping. It is Markup’s hole in the same wall, named the same way so a caller has to state that the contents are trusted.

A FieldKind::Radio drops them, and that is deliberate rather than an oversight: a radio group is a set of sibling inputs with no one control element, so there is nowhere honest to put an attribute meant for the control. The group carries the descriptions for the same reason.

§id_prefix: Option<&'a str>

Scopes the id attributes to one instance of the form.

The field’s name is what the value submits under and is the same wherever the form appears; its id has to be unique in the document, and those two facts stop agreeing the moment a form appears twice. goingson hits this directly: its new-task and edit-task modals are the same field set, so it prefixes form-modal-task-new or -edit to keep label for and aria-describedby pointing at the right control.

Applies to id, for and the -hint / -error associations. Never to name, which would change what the form submits.

Implementations§

Source§

impl<'a> Filling<'a>

Source

pub const fn of(value: Value<'a>) -> Self

A filling that carries a value and nothing else.

Trait Implementations§

Source§

impl<'a> Clone for Filling<'a>

Source§

fn clone(&self) -> Filling<'a>

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<'a> Copy for Filling<'a>

Source§

impl<'a> Debug for Filling<'a>

Source§

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

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

impl<'a> Default for Filling<'a>

Source§

fn default() -> Filling<'a>

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

Auto Trait Implementations§

§

impl<'a> Freeze for Filling<'a>

§

impl<'a> RefUnwindSafe for Filling<'a>

§

impl<'a> Send for Filling<'a>

§

impl<'a> Sync for Filling<'a>

§

impl<'a> Unpin for Filling<'a>

§

impl<'a> UnsafeUnpin for Filling<'a>

§

impl<'a> UnwindSafe for Filling<'a>

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.