Trait Constructable

Source
pub trait Constructable {
    // Required methods
    fn get_constructor_path(&self) -> Path;
    fn build_constructor(
        &self,
        generator: impl Fn(NamedOrUnnamedField<'_>) -> Result<Expr, Box<dyn Error>>,
    ) -> Result<Expr, Box<dyn Error>>;
    fn get_fields(&self) -> &Fields;
    fn get_fields_mut(&mut self) -> &mut Fields;
}
Expand description

A Rust structure which can be created (either a struct or enum variant)

Required Methods§

Source

fn get_constructor_path(&self) -> Path

Get the path required to construct the expression

Source

fn build_constructor( &self, generator: impl Fn(NamedOrUnnamedField<'_>) -> Result<Expr, Box<dyn Error>>, ) -> Result<Expr, Box<dyn Error>>

Builds a constructor expression by evaluating a expression generator for each field

Source

fn get_fields(&self) -> &Fields

Source

fn get_fields_mut(&mut self) -> &mut 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.

Implementors§