pub trait FieldMapping: CommentMapping {
// Required methods
fn to_from_clause(
&self,
sexpr_mod: &TokenStream,
param: &TokenStream,
) -> TokenStream;
fn to_init_clause(&self, param: &TokenStream) -> TokenStream;
fn to_type_definition(&self, ty_mod: &TokenStream) -> TokenStream;
fn to_ident(&self) -> Option<TokenStream>;
fn to_definition_clause(
&self,
vis: &TokenStream,
ty: &TokenStream,
) -> TokenStream;
}Available on crate feature
lang only.Expand description
A trait to help mapping Field to rust field clause.
Required Methods§
Sourcefn to_from_clause(
&self,
sexpr_mod: &TokenStream,
param: &TokenStream,
) -> TokenStream
fn to_from_clause( &self, sexpr_mod: &TokenStream, param: &TokenStream, ) -> TokenStream
Generate rust from clause for this field: Some(value) or Variable::Constant(value)
Sourcefn to_init_clause(&self, param: &TokenStream) -> TokenStream
fn to_init_clause(&self, param: &TokenStream) -> TokenStream
Generate rust struct field init clause: a: 1usize or b: value.0.
Sourcefn to_type_definition(&self, ty_mod: &TokenStream) -> TokenStream
fn to_type_definition(&self, ty_mod: &TokenStream) -> TokenStream
Convert field Type to rust filed type.
Sourcefn to_ident(&self) -> Option<TokenStream>
fn to_ident(&self) -> Option<TokenStream>
Generate rust field ident for Field
Sourcefn to_definition_clause(
&self,
vis: &TokenStream,
ty: &TokenStream,
) -> TokenStream
fn to_definition_clause( &self, vis: &TokenStream, ty: &TokenStream, ) -> TokenStream
Generate field definition clause for this field.