pub trait StructForm<Model> {
type Field;
// Required methods
fn new(model: &Model) -> Self;
fn set_input(&mut self, field: Self::Field, value: String);
fn submit(&mut self) -> Result<Model, ParseError>;
fn submit_update(&mut self, model: Model) -> Result<Model, ParseError>;
fn submit_attempted(&self) -> bool;
fn is_empty(&self) -> bool;
// Provided methods
fn has_unsaved_changes(&self, pristine: &Model) -> bool
where Self: Clone,
Model: Clone + PartialEq { ... }
fn validation_error(&self) -> Option<ParseError>
where Self: Clone { ... }
}
Required Associated Types§
Required Methods§
fn new(model: &Model) -> Self
fn set_input(&mut self, field: Self::Field, value: String)
fn submit(&mut self) -> Result<Model, ParseError>
fn submit_update(&mut self, model: Model) -> Result<Model, ParseError>
fn submit_attempted(&self) -> bool
fn is_empty(&self) -> bool
Provided Methods§
fn has_unsaved_changes(&self, pristine: &Model) -> bool
fn validation_error(&self) -> Option<ParseError>where
Self: Clone,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.