Expand description
§memory — FFI-safe heap buffers and strings
Provides FfiBuffer and FfiString: the two heap-allocated primitive
types that cross the Go↔Rust boundary.
§Ownership model
Rust allocates → caller (Go) reads → Rust frees- Rust is always the allocator. Go never allocates these types directly.
- The Go side must call the matching
ffi_*_freeexported function when it is done with a value. Rust’s allocator is invoked; Go’s GC is not involved. FfiBufferandFfiStringarerepr(C)structs of raw pointers + sizes. They have no Drop impl — they cannot be safely dropped by Rust without explicit deallocation, which is intentional: the Go side controls lifetime.
Structs§
Functions§
- ffi_
buffer_ alloc - Allocate an
FfiBufferofcapacitybytes. - ffi_
buffer_ free - Free an
FfiBufferpreviously allocated by this crate. - ffi_
string_ ⚠alloc - Allocate and copy a UTF-8 string of
lenbytes starting atstr. - ffi_
string_ free - Free an
FfiStringpreviously allocated by this crate.