[][src]Struct wrapgen::WrapGen

pub struct WrapGen<'a> { /* fields omitted */ }

The builder struct to create wrappers. Create an instance, add the files, types and functions you want to wrap and finally call generate() to create the wrappers.

Examples

Wrap some functions

WrapGen::new("examples/to_wrap.rs").generate("outfile.rs");

Wrap a pointer type

WrapGen::default()
        .wrap_pointer_type(
            WrapperType::new("inode", "Inode")
                .with_field("i_sb", "*mut super_block")
                .with_field_writeonly("i_ino", "cty::c_int"),
        )
        .generate("outfile.rs")

Implementations

impl<'a> WrapGen<'a>[src]

pub fn default() -> Self[src]

Create a new WrapGen without reading from any files

pub fn add_file<P: AsRef<Path>>(self, file: P) -> Self[src]

Add all the functions from file

pub fn add_function(self, function: &'a str) -> Self[src]

Add the single function from function. A semicolon at the end is optional here.

pub fn prefix(self, prefix: &'a str) -> Self[src]

Set the prefix of the wrapped functions. Defaults to rs_

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

Determines if core::ptr or std::ptr should be used

pub fn new<P: AsRef<Path>>(file: P) -> Self[src]

Create a new WrapGen and add the functions listed in file

pub fn wrap_pointer_type(self, to_wrap: WrapperType<'a>) -> Self[src]

Will create a wrapper around a type (usually a pointer) to allow safe access to fields

pub fn generate<P: AsRef<Path>>(&'a mut self, outfile_path: P)[src]

Generate wrappers for all previously added functions and write them to outfile_path

Trait Implementations

impl<'a> Clone for WrapGen<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for WrapGen<'a>

impl<'a> Send for WrapGen<'a>

impl<'a> Sync for WrapGen<'a>

impl<'a> Unpin for WrapGen<'a>

impl<'a> UnwindSafe for WrapGen<'a>

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.