pub struct Generator { /* private fields */ }Expand description
Generator is a main point of flapigen.
It expands rust macroses and generates not rust code.
It designed to use inside build.rs.
Implementations§
Source§impl Generator
impl Generator
pub fn new(config: LanguageConfig) -> Generator
Sourcepub fn with_pointer_target_width(self, pointer_target_width: usize) -> Self
pub fn with_pointer_target_width(self, pointer_target_width: usize) -> Self
By default we get pointer_target_width via cargo (more exactly CARGO_CFG_TARGET_POINTER_WIDTH), but you can change default value via this method
Sourcepub fn rustfmt_bindings(self, doit: bool) -> Self
pub fn rustfmt_bindings(self, doit: bool) -> Self
Set whether rustfmt should format the generated bindings.
Sourcepub fn remove_not_generated_files_from_output_directory(
self,
doit: bool,
) -> Self
pub fn remove_not_generated_files_from_output_directory( self, doit: bool, ) -> Self
If true removes not generated by flapigen files from output directory, suitable for removing obsolete files. Warning! May remove your files if turn on, so by default false
Sourcepub fn merge_type_map(self, id_of_code: &str, code: &str) -> Self
pub fn merge_type_map(self, id_of_code: &str, code: &str) -> Self
Add new foreign langauge type <-> Rust mapping
Sourcepub fn register_class_attribute_callback<F>(
self,
attr_name: &str,
cb: F,
) -> Self
pub fn register_class_attribute_callback<F>( self, attr_name: &str, cb: F, ) -> Self
Register callback to extend/modify class, if foreign_class has #[derive(attr_name)]
then after foreign code generation cb would be called, with full code of module,
plus class name
Sourcepub fn register_enum_attribute_callback<F>(self, attr_name: &str, cb: F) -> Self
pub fn register_enum_attribute_callback<F>(self, attr_name: &str, cb: F) -> Self
Register callback to extend/modify enum, if foreign_enum has #[derive(attr_name)]
then after foreign code generation cb would be called, with full code of module,
plus enum name
Sourcepub fn register_method_attribute_callback<F>(
self,
attr_name: &str,
cb: F,
) -> Self
pub fn register_method_attribute_callback<F>( self, attr_name: &str, cb: F, ) -> Self
Register callback to extend/modify method of class, if fn inside foreign_class
has attribute, then after foreign code generation cb would be called with full code
of moulde, plus class name, plus method name