MCPcopy Index your code
hub / github.com/WICG/webpackage / EncodeArrayHeader

Method EncodeArrayHeader

go/internal/cbor/encoder.go:139–152  ·  view source on GitHub ↗
(n int)

Source from the content-addressed store, hash-verified

137}
138
139func (e *Encoder) EncodeArrayHeader(n int) error {
140 // Major type 4: an array of data items. Arrays are also called lists,
141 // sequences, or tuples. The array's length follows the rules for
142 // byte strings (major type 2), except that the length denotes the
143 // number of data items, not the length in bytes that the array takes
144 // up. Items in an array do not need to all be of the same type.
145 // For example, an array that contains 10 items of any type would
146 // have an initial byte of 0b100_01010 (major type of 4, additional
147 // information of 10 for the length) followed by the 10 remaining
148 // items.
149 //
150 // https://tools.ietf.org/html/rfc7049#section-2.1
151 return e.encodeTypedUint(TypeArray, uint64(n))
152}
153
154func (e *Encoder) encodeMapHeader(n int) error {
155 return e.encodeTypedUint(TypeMap, uint64(n))

Callers 12

CborBytesMethod · 0.95
newResponsesSectionFunction · 0.95
addResponseMethod · 0.95
newSignaturesSectionFunction · 0.95
writeSectionOffsetsFunction · 0.95
writeSectionHeaderFunction · 0.95
WriteMethod · 0.95
cborBytesMethod · 0.80
TestMapEncoderFunction · 0.80
FinalizeMethod · 0.80
EncodeMethod · 0.80
encodeExchangeHeadersMethod · 0.80

Calls 1

encodeTypedUintMethod · 0.95

Tested by 1

TestMapEncoderFunction · 0.64