pub trait StructType: Send + Sync {
// Required methods
fn get_type(&self) -> &Type;
fn new_value<'b, 'v>(
&self,
fields: BTreeMap<String, CowVal<'b, 'v>>,
) -> Result<Box<dyn Val + 'v>, ExecutionError>;
}Expand description
Required Methods§
Sourcefn get_type(&self) -> &Type
fn get_type(&self) -> &Type
The struct’s type: its name is the one struct literals construct it by, and the one it is registered under.
Sourcefn new_value<'b, 'v>(
&self,
fields: BTreeMap<String, CowVal<'b, 'v>>,
) -> Result<Box<dyn Val + 'v>, ExecutionError>
fn new_value<'b, 'v>( &self, fields: BTreeMap<String, CowVal<'b, 'v>>, ) -> Result<Box<dyn Val + 'v>, ExecutionError>
Creates a value of this type from the fields of a struct literal.
§Errors
Fails when the fields do not make a value of this type, e.g. an unknown field or a value of the wrong type.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".