pub struct FormMetadata {
pub fields: Vec<FieldMetadata>,
pub initial: HashMap<String, Value>,
pub prefix: String,
pub is_bound: bool,
pub errors: HashMap<String, Vec<String>>,
pub validation_rules: Vec<ValidationRule>,
pub non_field_errors: Vec<String>,
}Expand description
Serializable form metadata for client-side rendering (Week 5 Day 1)
This structure contains all information needed to render a form on the
client-side without requiring the full Form struct with its trait objects.
§Fields
fields: Metadata for each form fieldinitial: Initial values for the form (form-level)prefix: Field name prefix (for multiple forms on same page)is_bound: Whether the form has been bound with dataerrors: Validation errors (if any)validation_rules: Client-side validation rules (Phase 2-A)non_field_errors: Form-level validation errors (Phase 2-A)
Fields§
§fields: Vec<FieldMetadata>Field metadata list
initial: HashMap<String, Value>Initial values (form-level)
prefix: StringField name prefix
is_bound: boolWhether the form has been bound with data
errors: HashMap<String, Vec<String>>Validation errors (field name -> error messages)
validation_rules: Vec<ValidationRule>Client-side validation rules (Phase 2-A) These rules enable immediate feedback to users without server round-trips. Server-side validation is still mandatory for security.
non_field_errors: Vec<String>Non-field errors (form-level errors) (Phase 2-A) These are errors that don’t belong to a specific field (e.g., “Passwords don’t match”)
Trait Implementations§
Source§impl Clone for FormMetadata
impl Clone for FormMetadata
Source§fn clone(&self) -> FormMetadata
fn clone(&self) -> FormMetadata
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FormMetadata
impl Debug for FormMetadata
Source§impl<'de> Deserialize<'de> for FormMetadata
impl<'de> Deserialize<'de> for FormMetadata
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 FormMetadata
impl RefUnwindSafe for FormMetadata
impl Send for FormMetadata
impl Sync for FormMetadata
impl Unpin for FormMetadata
impl UnsafeUnpin for FormMetadata
impl UnwindSafe for FormMetadata
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