pub struct UUIDField {
pub name: String,
pub required: bool,
pub error_messages: HashMap<String, String>,
pub widget: Widget,
pub help_text: String,
pub initial: Option<Value>,
}Expand description
A field for UUID validation
Validates that the input is a valid UUID (Universally Unique Identifier). Supports UUID v4 by default.
§Examples
use reinhardt_forms::fields::UUIDField;
use reinhardt_forms::Field;
use serde_json::json;
let field = UUIDField::new("id");
let result = field.clean(Some(&json!("550e8400-e29b-41d4-a716-446655440000")));
assert!(result.is_ok());
let result = field.clean(Some(&json!("not-a-uuid")));
assert!(result.is_err());Fields§
§name: String§required: bool§error_messages: HashMap<String, String>§widget: Widget§help_text: String§initial: Option<Value>Implementations§
Trait Implementations§
Source§impl FormField for UUIDField
impl FormField for UUIDField
fn name(&self) -> &str
fn label(&self) -> Option<&str>
fn widget(&self) -> &Widget
fn required(&self) -> bool
fn initial(&self) -> Option<&Value>
fn help_text(&self) -> Option<&str>
fn clean(&self, value: Option<&Value>) -> FieldResult<Value>
Auto Trait Implementations§
impl Freeze for UUIDField
impl RefUnwindSafe for UUIDField
impl Send for UUIDField
impl Sync for UUIDField
impl Unpin for UUIDField
impl UnsafeUnpin for UUIDField
impl UnwindSafe for UUIDField
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