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
Auto Trait Implementations§
impl Freeze for Generator
impl !RefUnwindSafe for Generator
impl !Send for Generator
impl !Sync for Generator
impl Unpin for Generator
impl !UnwindSafe for Generator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more