#[non_exhaustive]pub enum ValidatorSpec {
NonEmpty,
Regex(String),
Predefined(String),
Format {
format: Format,
min_length: Option<usize>,
max_length: Option<usize>,
},
}Expand description
Validator applied by the runtime to a typed response before it is accepted.
The rule is part of the prompt, so it is recorded with it: a transcript
says a six-digit secret was entered, never which one. check
is the one place a rule is applied, so rite check and the running
ceremony agree on what a pattern accepts.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
NonEmpty
Reject empty or whitespace-only input.
Regex(String)
Input must match this regular expression in full.
Predefined(String)
Named, runtime-defined predicate (e.g. serial_number).
Format
A value of one Format, with a length within bounds.
What a PIN or a key component needs, stated without a pattern the person writing the ceremony has to get right. The length is counted in the format’s own units: characters for text, bytes for an encoding.
Implementations§
Trait Implementations§
Source§impl Clone for ValidatorSpec
impl Clone for ValidatorSpec
Source§impl Debug for ValidatorSpec
impl Debug for ValidatorSpec
Source§impl<'de> Deserialize<'de> for ValidatorSpec
impl<'de> Deserialize<'de> for ValidatorSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ValidatorSpec
impl RefUnwindSafe for ValidatorSpec
impl Send for ValidatorSpec
impl Sync for ValidatorSpec
impl Unpin for ValidatorSpec
impl UnsafeUnpin for ValidatorSpec
impl UnwindSafe for ValidatorSpec
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