Skip to main content

FieldKindDef

Enum FieldKindDef 

Source
pub enum FieldKindDef {
Show 27 variants Text, Textarea, Password, Number, Decimal(String), Checkbox, Select(Vec<(String, String)>), Lookup, Date, DateTime, Email, Url, Radio(Vec<(String, String)>), Color, Image, File, Link, Wysiwyg, PostObject, Relationship, Taxonomy, User, Repeater(Vec<FieldDef>), Group(Vec<FieldDef>), FlexibleContent(Vec<BlockDef>), Gallery, Clone(Vec<FieldDef>),
}
Expand description

The kind of a FieldDef: every FieldKind, with owned values so it can be loaded from a database.

Variants§

§

Text

A single line of text. See FieldKind::Text.

§

Textarea

Several lines of text. See FieldKind::Textarea.

§

Password

A password, hashed on save. See FieldKind::Password.

§

Number

A whole number. See FieldKind::Number.

§

Decimal(String)

A decimal number, with the browser’s step, such as "any" or "0.01". See FieldKind::Decimal.

§

Checkbox

A yes/no value. See FieldKind::Checkbox.

§

Select(Vec<(String, String)>)

One choice from a list of (value, label) pairs. See FieldKind::Select.

§

Lookup

One choice from options that RuntimeData::options loads. See FieldKind::Lookup.

§

Date

A calendar date. See FieldKind::Date.

§

DateTime

A date and time. See FieldKind::DateTime.

§

Email

An email address. See FieldKind::Email.

§

Url

A URL. See FieldKind::Url.

§

Radio(Vec<(String, String)>)

One choice from a list of (value, label) pairs, as radio buttons. See FieldKind::Radio.

§

Color

A color, as #rrggbb. See FieldKind::Color.

§

Image

An image from the media library. See FieldKind::Image.

§

File

A file from the media library. See FieldKind::File.

A link, as JSON text. See FieldKind::Link.

§

Wysiwyg

Rich text, edited with the app’s editor. See FieldKind::Wysiwyg.

§

PostObject

One post, from options RuntimeData::options loads. See FieldKind::PostObject.

§

Relationship

Several choices, from options RuntimeData::options loads. See FieldKind::Relationship.

§

Taxonomy

One taxonomy term, from loaded options. See FieldKind::Taxonomy.

§

User

One user, from loaded options. See FieldKind::User.

§

Repeater(Vec<FieldDef>)

Rows of the given sub-fields, as JSON text. See FieldKind::Repeater.

§

Group(Vec<FieldDef>)

The given sub-fields, as one JSON object. See FieldKind::Group.

§

FlexibleContent(Vec<BlockDef>)

Rows that each take one of the given blocks, as JSON text. See FieldKind::FlexibleContent.

§

Gallery

Several images from the media library, as a JSON array of ids. See FieldKind::Gallery.

§

Clone(Vec<FieldDef>)

The fields of another field group, reused. See FieldKind::Clone.

Implementations§

Source§

impl FieldKindDef

Source

pub fn loads_options(&self) -> bool

Whether the field’s choices come from RuntimeData::options each time its form is shown. See FieldKind::loads_options.

Source

pub fn uses_media(&self) -> bool

Whether the field holds media library ids: an image, a file or a gallery.

Trait Implementations§

Source§

impl Clone for FieldKindDef

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 FieldKindDef

Source§

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

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

impl Eq for FieldKindDef

Source§

impl From<FieldKind> for FieldKindDef

Source§

fn from(kind: FieldKind) -> Self

Converts to this type from the input type.
Source§

impl Hash for FieldKindDef

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FieldKindDef

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 StructuralPartialEq for FieldKindDef

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
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<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