pub trait FormWith<C> {
// Required method
fn new_form_with_(
context: &C,
field: &str,
from: Option<&Self>,
depth: usize,
) -> (FormElements, Box<dyn FormState<Self>>);
// Provided method
fn new_form_with(
context: &C,
field: &str,
from: Option<&Self>,
) -> (FormElements, Box<dyn FormState<Self>>) { ... }
}
Expand description
Like Form
but allows passing in additional context, for custom elements that
need it. FormWith<()>
is generated by the Form
derive macro.
Required Methods§
fn new_form_with_( context: &C, field: &str, from: Option<&Self>, depth: usize, ) -> (FormElements, Box<dyn FormState<Self>>)
Provided Methods§
Sourcefn new_form_with(
context: &C,
field: &str,
from: Option<&Self>,
) -> (FormElements, Box<dyn FormState<Self>>)
fn new_form_with( context: &C, field: &str, from: Option<&Self>, ) -> (FormElements, Box<dyn FormState<Self>>)
Generates a form state manager to produce form elements and parse the entered values.
context
- any additional data to be used when generating form states and elements. This is forwarded to all nestednew_form
calls.
See Form
for the other fields.
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.