FieldMapping

Trait FieldMapping 

Source
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§

Source

fn to_from_clause( &self, sexpr_mod: &TokenStream, param: &TokenStream, ) -> TokenStream

Generate rust from clause for this field: Some(value) or Variable::Constant(value)

Source

fn to_init_clause(&self, param: &TokenStream) -> TokenStream

Generate rust struct field init clause: a: 1usize or b: value.0.

Source

fn to_type_definition(&self, ty_mod: &TokenStream) -> TokenStream

Convert field Type to rust filed type.

Source

fn to_ident(&self) -> Option<TokenStream>

Generate rust field ident for Field

Source

fn to_definition_clause( &self, vis: &TokenStream, ty: &TokenStream, ) -> TokenStream

Generate field definition clause for this field.

Implementors§

Source§

impl<'a> FieldMapping for Field<'a>