MCPcopy Create free account
hub / github.com/apache/fory / writeDataWithGenerics

Method writeDataWithGenerics

go/fory/slice_primitive_list.go:96–110  ·  view source on GitHub ↗
(ctx *WriteContext, value reflect.Value, hasGenerics bool)

Source from the content-addressed store, hash-verified

94}
95
96func (s primitiveListSerializer) writeDataWithGenerics(ctx *WriteContext, value reflect.Value, hasGenerics bool) {
97 length := value.Len()
98 buf := ctx.Buffer()
99 buf.WriteVarUint32(uint32(length))
100 if length == 0 {
101 return
102 }
103 if hasGenerics {
104 buf.WriteInt8(CollectionDeclSameType)
105 } else {
106 buf.WriteInt8(CollectionIsSameType)
107 ctx.TypeResolver().WriteTypeInfo(buf, &TypeInfo{Type: s.type_.Elem(), TypeID: uint32(s.elemTypeID)}, ctx.Err())
108 }
109 s.writeValues(buf, value)
110}
111
112func (s primitiveListSerializer) writeValues(buf *ByteBuffer, value reflect.Value) {
113 switch s.type_.Elem().Kind() {

Callers 2

WriteDataMethod · 0.95
WriteMethod · 0.95

Calls 9

writeValuesMethod · 0.95
LenMethod · 0.80
uint32Function · 0.50
BufferMethod · 0.45
WriteVarUint32Method · 0.45
WriteInt8Method · 0.45
WriteTypeInfoMethod · 0.45
TypeResolverMethod · 0.45
ErrMethod · 0.45

Tested by

no test coverage detected