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§
Sourcefn get_constructor_path(&self) -> Path
fn get_constructor_path(&self) -> Path
Get the path required to construct the expression
Sourcefn build_constructor(
&self,
generator: impl Fn(NamedOrUnnamedField<'_>) -> Result<Expr, Box<dyn Error>>,
) -> Result<Expr, Box<dyn Error>>
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
fn get_fields(&self) -> &Fields
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.