| Crates.io | seasick |
| lib.rs | seasick |
| version | 0.4.7 |
| created_at | 2024-11-30 01:52:05.311254+00 |
| updated_at | 2025-06-21 23:52:22.083571+00 |
| description | Tools for implementing and transcribing C APIs. |
| homepage | https://crates.io/crates/seasick |
| repository | https://github.com/aatifsyed/seasick |
| max_upload_size | |
| id | 1466224 |
| size | 69,233 |
Tools for implementing and transcribing C APIs.
&CStr, CString and Box are not FFI safe.
#[deny(improper_ctypes_definitions)]
extern "C" fn bad(_: &CStr, _: Box<u8>) -> CString { todo!() }
&SeaStr, [SeaString] and [SeaBox] are FFI-safe equivalents.
#[deny(improper_ctypes_definitions)]
extern "C" fn good(_: &SeaStr, _: SeaBox<u8>) -> SeaString { todo!() }
All are pointer-wide, with a non-null niche filled by [Option::None].
assert_eq!(size_of::<SeaBox<u8>>(), size_of::<*mut u8>());
assert_eq!(size_of::<Option<SeaBox<u8>>>(), size_of::<*mut u8>());
assert_eq!(size_of::<SeaString>(), size_of::<*mut c_char>());
assert_eq!(size_of::<Option<SeaString>>(), size_of::<*mut c_char>());
[trait@TransmuteFrom] is the culmination of this crate,
for writing your own wrappers to C types.
See its documentation for more.