MCPcopy Create free account
hub / github.com/google/gapid / Encode

Function Encode

gapil/bapi/encode.go:173–194  ·  view source on GitHub ↗

Encode serializes apis to a byte slice.

(apis []*semantic.API, mappings *semantic.Mappings)

Source from the content-addressed store, hash-verified

171
172// Encode serializes apis to a byte slice.
173func Encode(apis []*semantic.API, mappings *semantic.Mappings) ([]byte, error) {
174 e := &encoder{instances: &Instances{}}
175 e.maps.build()
176 content := &Content{
177 Instances: e.instances,
178 Apis: make([]uint64, len(apis)),
179 }
180
181 // Serialize the APIs.
182 for i, api := range apis {
183 content.Apis[i] = e.api(api)
184 }
185
186 // Serialize the mappings.
187 content.Mappings = e.mappings(mappings)
188
189 data, err := proto.Marshal(content)
190 if err != nil {
191 return nil, err
192 }
193 return data, nil
194}
195
196func (e *encoder) mappings(m *semantic.Mappings) *Mappings {
197 out := Mappings{}

Callers

nothing calls this directly

Calls 3

apiMethod · 0.95
mappingsMethod · 0.95
buildMethod · 0.65

Tested by

no test coverage detected