[−][src]Struct wrapgen::WrapGen
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,