1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! FFI-safe replacements for common Rust standard library types.
//!
//! Types in this module are designed to be used with the `ffi::` prefix in function
//! signatures, keeping it clear at the call site that a type crosses the FFI boundary:
//!
//! ```rust
//! use interoptopus::ffi;
//!
//! # #[ffi]
//! # pub enum MyError { General }
//! #
//! #[ffi]
//! pub fn lookup_name(id: u32) -> ffi::Result<ffi::String, MyError> {
//! ffi::Ok("hello".to_string().into())
//! }
//! ```
//!
//! Each type mirrors its `std` counterpart but uses a `#[repr(C)]` layout safe for
//! passing across the FFI boundary:
//!
//! | `ffi::` type | Replaces |
//! |--------------------|-----------------------------|
//! | [`Option<T>`] | `std::option::Option<T>` |
//! | [`Result<T, E>`] | `std::result::Result<T, E>` |
//! | [`String`] | `std::string::String` |
//! | [`Vec<T>`] | `std::vec::Vec<T>` |
//! | [`Slice<T>`] | `&[T]` |
//! | [`SliceMut<T>`] | `&mut [T]` |
//! | [`CStrPtr`] | `*const c_char` |
//! | [`Bool`] | `bool` |
//! | [`CChar`] | `c_char` |
//!
//! See the [reference project](https://github.com/ralfbiedert/interoptopus/tree/master/crates/reference_project/src)
//! for comprehensive usage examples.
pub use crateCStrPtr;
pub use crate;
pub use crate;
pub use crate;
pub use crate;
pub use crateString;
pub use crateVec;
pub use crate;