Skip to main content

EmbeddedForm

Trait EmbeddedForm 

Source
pub trait EmbeddedForm: Sized {
    // Provided methods
    fn write_form<M>(
        &self,
        cx: &Cx,
        parent: impl Into<Path<M, Self>>,
        out: &mut HashMap<String, String>,
    )
       where M: Model { ... }
    fn read_form<M>(
        cx: &Cx,
        parent: impl Into<Path<M, Self>>,
        values: &HashMap<String, String>,
    ) -> Result<Self, Vec<FieldError>>
       where M: Model { ... }
}
Expand description

Reads an embedded value from and writes it to the flat form map; derive it to generate the value’s schema.

Provided Methods§

Source

fn write_form<M>( &self, cx: &Cx, parent: impl Into<Path<M, Self>>, out: &mut HashMap<String, String>, )
where M: Model,

Writes this value’s leaves into out, including the active variant’s discriminant for an enum.

Source

fn read_form<M>( cx: &Cx, parent: impl Into<Path<M, Self>>, values: &HashMap<String, String>, ) -> Result<Self, Vec<FieldError>>
where M: Model,

Reads a value back from a submission, taking an embedded enum’s variant from the discriminant key and refusing a discriminant that names no variant.

§Errors

Every leaf whose value its type refuses, and a discriminant that names no variant.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§