ffi_convert_extra_ctypes/lib.rs
1//! C-compatible mirrors of a few standard Rust containers, for use with
2//! [`ffi-convert`](https://docs.rs/ffi-convert).
3//!
4//! The three types exposed here cover the containers most FFI boundaries
5//! inevitably need:
6//!
7//! | Rust type | C-compatible mirror |
8//! |------------------|--------------------------------|
9//! | `Vec<T>` | [`CArray<T>`] |
10//! | `Vec<String>` | [`CStringArray`] |
11//! | `std::ops::Range<T>` | [`CRange<T>`] |
12//!
13//! Each mirror implements [`CReprOf`](ffi_convert::CReprOf),
14//! [`AsRust`](ffi_convert::AsRust), and [`CDrop`](ffi_convert::CDrop), so it
15//! can be embedded in any struct you derive the conversion traits on — see
16//! the top-level [`ffi-convert`](https://docs.rs/ffi-convert) documentation
17//! for how the pieces fit together.
18//!
19//! This crate is optional: if none of these types fit your layout, depend on
20//! `ffi-convert` alone and define your own `#[repr(C)]` container with the
21//! conversion trait impls you need.
22
23mod c_array;
24mod c_range;
25mod c_string_array;
26
27pub use c_array::CArray;
28pub use c_range::CRange;
29pub use c_string_array::CStringArray;