[][src]Macro foreign_types::foreign_type

macro_rules! foreign_type {
    ($($t:tt)*) => { ... };
}

A macro to easily define wrappers for foreign types.

Examples

#[macro_use]
extern crate foreign_types;

foreign_type! {
    /// Documentation for the owned type.
    pub type Ssl: Sync + Send {
        type CType = openssl_sys::SSL;
        fn drop = openssl_sys::SSL_free;
        fn clone = openssl_sys::SSL_dup;
    }

    /// This type immutably borrows other data and has a limited lifetime!
    pub type Thing<'a>: Send {
        type CType = foo_sys::THING;
        type PhantomData = &'a ();
        fn drop = foo_sys::THING_free;
    }
}