macro_rules! ffi_vec {
($vec_type:ident($iter_type:ident, $iter_mut_type:ident) -> $type:ident,
len($len_func:path),
get($get_func:path),
get_mut($get_mut_func:path),
grow($grow_func:path),
clear($clear_func:path)) => { ... };
}Expand description
Generates iterator types for FFI containers.
ยงExample
mod bindings {
pub enum ContainerType {}
pub enum ContainerItem {}
extern {
pub fn container_name_len(c: *const ContainerType) -> usize;
pub fn container_name_get(c: *const ContainerType, pos: usize) -> *const ContainerItem;
pub fn container_name_get_mut(c: *mut ContainerType, pos: usize) -> *mut ContainerItem;
pub fn container_name_grow(c: *mut ContainerType) -> *mut ContainerItem;
pub fn container_name_clear(c: *mut ContainerType);
}
}
use bindings::{ContainerType, ContainerItem};
easy_ffi_wrapper::ffi_vec!(
ContainerType(ContainerIter, ContainerIterMut) -> ContainerItem,
len(bindings::container_name_len),
get(bindings::container_name_get),
get_mut(bindings::container_name_get_mut),
grow(bindings::container_name_grow),
clear(bindings::container_name_clear)
);