pub struct Enum { /* private fields */ }Expand description
(enumeration feature) Accepts a value drawn from a fixed allow-list. The allowed values may be of any type,
and are compared by equality (no coercion).
Implementations§
Source§impl Enum
impl Enum
Sourcepub fn with_meta(self, meta: Meta) -> Self
pub fn with_meta(self, meta: Meta) -> Self
Attach human-facing metadata (name, description, examples, default, output conversion).
Sourcepub fn new(values: impl IntoIterator<Item = Value>) -> Self
pub fn new(values: impl IntoIterator<Item = Value>) -> Self
Build from the allowed values, e.g. Enum::new([Value::Int(1), Value::Int(2)]).
Sourcepub fn case_insensitive(self) -> Self
pub fn case_insensitive(self) -> Self
Compare string values ignoring ASCII case (no effect on other types).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Enum
impl RefUnwindSafe for Enum
impl Send for Enum
impl Sync for Enum
impl Unpin for Enum
impl UnsafeUnpin for Enum
impl UnwindSafe for Enum
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> WithMeta for Twhere
T: Validator,
impl<T> WithMeta for Twhere
T: Validator,
Source§fn description(&self) -> Option<&str>
fn description(&self) -> Option<&str>
The description, if any.
Source§fn examples(&self) -> &[(Value, Option<String>)]
fn examples(&self) -> &[(Value, Option<String>)]
The example values (each with an optional note).
Source§fn default_value(&self) -> Option<&Value>
fn default_value(&self) -> Option<&Value>
The default value, if any.
Source§fn with_name(self, name: impl Into<String>) -> Self
fn with_name(self, name: impl Into<String>) -> Self
Set the human-readable name (surfaced in error messages).
Source§fn with_description(self, text: impl Into<String>) -> Self
fn with_description(self, text: impl Into<String>) -> Self
Attach a human-readable description.
Source§fn with_example(self, value: impl Into<Value>) -> Self
fn with_example(self, value: impl Into<Value>) -> Self
Add an example value.
Source§fn with_example_noted(
self,
value: impl Into<Value>,
note: impl Into<String>,
) -> Self
fn with_example_noted( self, value: impl Into<Value>, note: impl Into<String>, ) -> Self
Add an example value with an explanatory note.
Source§fn with_default(self, value: impl Into<Value>) -> Self
fn with_default(self, value: impl Into<Value>) -> Self
Set the default value used as an on-error fallback (see the pipeline’s validate stage).