MCPcopy
hub / github.com/protocolbuffers/protobuf-go / marshalList

Method marshalList

encoding/prototext/encode.go:268–277  ·  view source on GitHub ↗

marshalList marshals the given protoreflect.List as multiple name-value fields.

(name string, list protoreflect.List, fd protoreflect.FieldDescriptor)

Source from the content-addressed store, hash-verified

266
267// marshalList marshals the given protoreflect.List as multiple name-value fields.
268func (e encoder) marshalList(name string, list protoreflect.List, fd protoreflect.FieldDescriptor) error {
269 size := list.Len()
270 for i := 0; i < size; i++ {
271 e.WriteName(name)
272 if err := e.marshalSingular(list.Get(i), fd); err != nil {
273 return err
274 }
275 }
276 return nil
277}
278
279// marshalMap marshals the given protoreflect.Map as multiple name-value fields.
280func (e encoder) marshalMap(name string, mmap protoreflect.Map, fd protoreflect.FieldDescriptor) error {

Callers 1

marshalFieldMethod · 0.95

Calls 4

marshalSingularMethod · 0.95
LenMethod · 0.65
GetMethod · 0.65
WriteNameMethod · 0.45

Tested by

no test coverage detected