Skip to main content

Generator

Struct Generator 

Source
pub struct Generator { /* private fields */ }
Expand description

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

Implementations§

Source§

impl Generator

Source

pub fn new(config: LanguageConfig) -> Generator

Source

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

Source

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

Set whether rustfmt should format the generated bindings.

Source

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

If true removes not generated by rust_swig files from output directory, suitable for removing obsolete files. Warning! May remove your files if turn on, so by default false

Source

pub fn merge_type_map(self, id_of_code: &str, code: &str) -> Generator

Add new foreign langauge type <-> Rust mapping

Source

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

process src and save result of macro expansion to dst

§Panics

Panics on error

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.