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

Method GetExportIndex

component_feat_component_model.go:134–152  ·  view source on GitHub ↗

GetExportIndex looks up the export named `name` in this component and returns a reusable [ComponentExportIndex] handle pointing at it. Pass `nil` for `parent` to search the component's root namespace. Pass an index returned by an earlier call (whose result identified an exported instance) to traver

(parent *ComponentExportIndex, name string)

Source from the content-addressed store, hash-verified

132//
133// Returns `nil` if no matching export is found.
134func (c *Component) GetExportIndex(parent *ComponentExportIndex, name string) *ComponentExportIndex {
135 var parentPtr *C.wasmtime_component_export_index_t
136 if parent != nil {
137 parentPtr = parent.ptr()
138 }
139 idxPtr := C.wasmtime_component_get_export_index(
140 c.ptr(),
141 parentPtr,
142 C._GoStringPtr(name),
143 C._GoStringLen(name),
144 )
145 runtime.KeepAlive(c)
146 runtime.KeepAlive(parent)
147 runtime.KeepAlive(name)
148 if idxPtr == nil {
149 return nil
150 }
151 return mkComponentExportIndex(idxPtr)
152}
153
154// Type returns the [ComponentType] describing this component's imports
155// and exports. The returned value owns its underlying handle and must be

Calls 2

ptrMethod · 0.95
mkComponentExportIndexFunction · 0.85