Enum amplify_syn::ListReq[][src]

pub enum ListReq<T> where
    T: Clone
{ Single { whitelist: Option<Vec<T>>, default: Option<T>, }, Many { whitelist: Option<Vec<T>>, required: bool, max_no: Option<u8>, }, Predefined { whitelist: Option<Vec<T>>, default: Vec<T>, }, Deny, }
Expand description

Requirements for list elements. For instance, used in AttrReq for providing crate::ParametrizedAttr fields requirements.

Variants

Single

Only a single value allowed and it must be present

Fields of Single

whitelist: Option<Vec<T>>

Restricts set of possible values to the given whitelist

NB: If whitelist does not contain values from the default field, they are still accepted as valid, i.e. “automatically whitelisted”

default: Option<T>

Default value assigned as a signe list item if no values are provided

NB: If whitelist does not contain values from the default field, they are still accepted as valid, i.e. “automatically whitelisted”

Many

Any number of any elements may be present

Fields of Many

whitelist: Option<Vec<T>>

Restricts set of possible values to the given whitelist

required: bool

Require that at least one value is present

max_no: Option<u8>

Restricts the maximum number of items

Predefined

Any number of any elements may not be present; if none of the elements is present the list will use default vec of the values

Fields of Predefined

whitelist: Option<Vec<T>>

Restricts set of possible values to the given whitelist.

NB: If whitelist does not contain values from the default field, they are still accepted as valid, i.e. “automatically whitelisted”

default: Vec<T>

Default set of values for the list used if no values are provided

NB: If whitelist does not contain values from the default field, they are still accepted as valid, i.e. “automatically whitelisted”

Deny

Element must not be present

Implementations

Checks the value against the list requirements, generating Error if the requirements are not met.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.