Source File
counts.go
Belonging Package
github.com/tetratelabs/wazero/internal/wasm
package wasmimport// SectionElementCount returns the count of elements in a given section ID//// For example...// * SectionIDType returns the count of FunctionType// * SectionIDCustom returns the count of CustomSections plus one if NameSection is present// * SectionIDHostFunction returns the count of HostFunctionSection// * SectionIDExport returns the count of unique export namesfunc ( *Module) ( SectionID) uint32 { // element as in vector elements!switch {case SectionIDCustom::= uint32(len(.CustomSections))if .NameSection != nil {++}returncase SectionIDType:return uint32(len(.TypeSection))case SectionIDImport:return uint32(len(.ImportSection))case SectionIDFunction:return uint32(len(.FunctionSection))case SectionIDTable:return uint32(len(.TableSection))case SectionIDMemory:if .MemorySection != nil {return 1}return 0case SectionIDGlobal:return uint32(len(.GlobalSection))case SectionIDExport:return uint32(len(.ExportSection))case SectionIDStart:if .StartSection != nil {return 1}return 0case SectionIDElement:return uint32(len(.ElementSection))case SectionIDCode:return uint32(len(.CodeSection))case SectionIDData:return uint32(len(.DataSection))default:panic(fmt.Errorf("BUG: unknown section: %d", ))}}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |