Trait ligen::Generator [−][src]
pub trait Generator: FileGenerator + FFIGenerator { fn new(context: &Context, attributes: &Attributes) -> Self; fn pre_process(
&self,
_context: &Context,
implementation: Option<&Implementation>
) -> Option<Implementation> { ... } fn generate(
&self,
context: &Context,
implementation: Option<&Implementation>
) -> Result<TokenStream, Error> { ... } fn save_file_set(
&self,
context: &Context,
file_set: FileSet
) -> Result<(), Error> { ... } }
Expand description
Generator trait.
Required methods
fn new(context: &Context, attributes: &Attributes) -> Self
fn new(context: &Context, attributes: &Attributes) -> Self
Creates a new generator using contextual information and attributes.
Provided methods
fn pre_process(
&self,
_context: &Context,
implementation: Option<&Implementation>
) -> Option<Implementation>
fn pre_process(
&self,
_context: &Context,
implementation: Option<&Implementation>
) -> Option<Implementation>
Pre-processes the input. The default implementation returns a transformed input with all the
Self
and self
occurrences replaced by the actual object name.
fn generate(
&self,
context: &Context,
implementation: Option<&Implementation>
) -> Result<TokenStream, Error>
fn generate(
&self,
context: &Context,
implementation: Option<&Implementation>
) -> Result<TokenStream, Error>
Main function called in the procedural macro.