MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime-go / NewExportType

Function NewExportType

exporttype.go:15–29  ·  view source on GitHub ↗

NewExportType creates a new `ExportType` with the `name` and the type provided.

(name string, ty AsExternType)

Source from the content-addressed store, hash-verified

13
14// NewExportType creates a new `ExportType` with the `name` and the type provided.
15func NewExportType(name string, ty AsExternType) *ExportType {
16 nameVec := stringToByteVec(name)
17
18 // Creating an export type requires taking ownership, so create a copy
19 // so we don't have to invalidate pointers here. Shouldn't be too
20 // costly in theory anyway.
21 extern := ty.AsExternType()
22 ptr := C.wasm_externtype_copy(extern.ptr())
23 runtime.KeepAlive(extern)
24
25 // And once we've got all that create the export type!
26 exportPtr := C.wasm_exporttype_new(&nameVec, ptr)
27
28 return mkExportType(exportPtr, nil)
29}
30
31func mkExportType(ptr *C.wasm_exporttype_t, owner interface{}) *ExportType {
32 exporttype := &ExportType{_ptr: ptr, _owner: owner}

Callers 1

TestExportTypeFunction · 0.85

Calls 4

stringToByteVecFunction · 0.85
mkExportTypeFunction · 0.85
AsExternTypeMethod · 0.65
ptrMethod · 0.45

Tested by 1

TestExportTypeFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…