alef 0.25.37

Opinionated polyglot binding generator for Rust libraries
Documentation
1
2
3
4
5
6
7
8
9
10
11
// unmarshalBytes copies a C byte buffer into a Go []byte.
//
// The pointer is treated as a NUL-terminated C string; binary payloads
// that may contain interior NULs should be exposed by the FFI with an
// explicit length out-parameter instead.
func unmarshalBytes(ptr *C.uint8_t) []byte {
	if ptr == nil {
		return nil
	}
	return []byte(C.GoString((*C.char)(unsafe.Pointer(ptr))))
}