Expand description
FFI-safe string types for extern “C” function boundaries.
Rust String and &str are NOT FFI-safe (they have unspecified layout).
Use FfiString for passing strings across extern “C” boundaries.
Structs§
- FfiBytes
- C-compatible byte buffer: pointer + length + capacity.
Caller owns the allocation; use
ffi_free_bytesto free. - FfiString
- C-compatible string representation: pointer + length.
Caller owns the allocation; use
ffi_free_stringto free.
Functions§
- ffi_
free_ bytes - Free an FfiBytes returned from an extern function. Safe to call with null ptr or empty FfiBytes.
- ffi_
free_ string - Free an FfiString returned from an extern function. Safe to call with null ptr or empty FfiString.
- ffi_
to_ string - Convert FfiString to Rust String. The FfiString is consumed (memory is freed as part of this call).
- ffi_
to_ vec - Convert FfiBytes to Rust Vec
. The FfiBytes is consumed (memory is freed as part of this call). - string_
to_ ffi - Convert Rust String to FFI-safe FfiString.
Caller must call
ffi_free_stringon the result when done. - vec_
to_ ffi - Convert Rust Vec
to FFI-safe FfiBytes. Caller must call ffi_free_byteson the result when done.