MCPcopy
hub / github.com/openacid/slim / TypeEncoder

Struct TypeEncoder

encode/type_encoder.go:22–30  ·  view source on GitHub ↗

TypeEncoder provides encoding for fixed size types. Such as int32 or struct { X int32; Y int64; } "int" is not a fixed size type: int on different platform has different size, 4 or 8 bytes. "[]int32" is not a fixed size type: the data size is also defined by the number of elements.

Source from the content-addressed store, hash-verified

20// "[]int32" is not a fixed size type: the data size is also defined by the
21// number of elements.
22type TypeEncoder struct {
23 // Endian defines the byte order to encode a value.
24 // By default it is binary.LittleEndian
25 Endian binary.ByteOrder
26 // Type is the data type to encode.
27 Type reflect.Type
28 // Size is the encoded size of this type.
29 Size int
30}
31
32// NewTypeEncoder creates a *TypeEncoder by a value.
33// The value "zero" defines what type this Encoder can deal with and must be a

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected