[][src]Struct flapigen::Generator

pub struct Generator { /* fields omitted */ }

Generator is a main point of flapigen. It expands rust macroses and generates not rust code. It designed to use inside build.rs.

Implementations

impl Generator[src]

pub fn new(config: LanguageConfig) -> Generator[src]

pub fn with_pointer_target_width(self, pointer_target_width: usize) -> Self[src]

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

pub fn rustfmt_bindings(self, doit: bool) -> Self[src]

Set whether rustfmt should format the generated bindings.

pub fn remove_not_generated_files_from_output_directory(
    self,
    doit: bool
) -> Self
[src]

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

pub fn merge_type_map(self, id_of_code: &str, code: &str) -> Self[src]

Add new foreign langauge type <-> Rust mapping

pub fn register_class_attribute_callback<F>(
    self,
    attr_name: &str,
    cb: F
) -> Self where
    F: Fn(&mut Vec<u8>, &str) + 'static, 
[src]

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

pub fn register_method_attribute_callback<F>(
    self,
    attr_name: &str,
    cb: F
) -> Self where
    F: Fn(&mut Vec<u8>, MethodInfo<'_>) + 'static, 
[src]

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

pub fn expand<S, D>(self, crate_name: &str, src: S, dst: D) where
    S: AsRef<Path>,
    D: AsRef<Path>, 
[src]

process src and save result of macro expansion to dst

Panics

Panics on error

pub fn expand_many<S, D>(self, crate_name: &str, srcs: &[S], dst: D) where
    S: AsRef<Path>,
    D: AsRef<Path>, 
[src]

process srcs and save result of macro expansion to dst

Panics

Panics on error

Auto Trait Implementations

impl !RefUnwindSafe for Generator

impl !Send for Generator

impl !Sync for Generator

impl Unpin for Generator

impl !UnwindSafe for Generator

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.