MCPcopy Index your code
hub / github.com/google/gvisor / encodeArray

Method encodeArray

pkg/state/encode.go:541–552  ·  view source on GitHub ↗

encodeArray encodes an array.

(obj reflect.Value, dest *wire.Object)

Source from the content-addressed store, hash-verified

539
540// encodeArray encodes an array.
541func (es *encodeState) encodeArray(obj reflect.Value, dest *wire.Object) {
542 l := obj.Len()
543 a := &wire.Array{
544 Contents: make([]wire.Object, l),
545 }
546 *dest = a
547 for i := 0; i < l; i++ {
548 // We need to encode the full value because arrays are encoded
549 // using the type information from only the first element.
550 es.encodeObject(obj.Index(i), encodeAsValue, &a.Contents[i])
551 }
552}
553
554// findType recursively finds type information.
555func (es *encodeState) findType(typ reflect.Type) wire.TypeSpec {

Callers 1

encodeObjectMethod · 0.95

Calls 3

encodeObjectMethod · 0.95
LenMethod · 0.65
IndexMethod · 0.45

Tested by

no test coverage detected