[][src]Macro foreign_types::foreign_type

macro_rules! foreign_type {
    (
        $(#[$impl_attr:meta])*
        type CType = $ctype:ty;
        fn drop = $drop:expr;
        $(fn clone = $clone:expr;)*
        $(#[$owned_attr:meta])*
        pub struct $owned:ident;
        $(#[$borrowed_attr:meta])*
        pub struct $borrowed:ident;
    ) => { ... };
}

A macro to easily define wrappers for foreign types.

Examples

#[macro_use]
extern crate foreign_types;

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