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

Method Marshal

trie/slimtrie_marshal.go:20–30  ·  view source on GitHub ↗

Marshal serializes it to byte stream. Since 0.4.3

()

Source from the content-addressed store, hash-verified

18//
19// Since 0.4.3
20func (st *SlimTrie) Marshal() ([]byte, error) {
21 var buf []byte
22 writer := bytes.NewBuffer(buf)
23
24 _, err := pbcmpl.Marshal(writer, st.inner)
25 if err != nil {
26 return nil, errors.WithMessage(err, "failed to marshal st.inner")
27 }
28
29 return writer.Bytes(), nil
30}
31
32// Unmarshal a SlimTrie from a byte stream.
33//

Callers 15

TestU16EncodeDecodeFunction · 0.80
TestU16EncodeDecodeBigFunction · 0.80
TestU32EncodeDecodeFunction · 0.80
TestU32EncodeDecodeBigFunction · 0.80
TestU64EncodeDecodeFunction · 0.80
TestU64EncodeDecodeBigFunction · 0.80
TestI16EncodeDecodeFunction · 0.80
TestI16EncodeDecodeBigFunction · 0.80
TestI32EncodeDecodeFunction · 0.80
TestI32EncodeDecodeBigFunction · 0.80

Calls

no outgoing calls

Tested by 15

TestU16EncodeDecodeFunction · 0.64
TestU16EncodeDecodeBigFunction · 0.64
TestU32EncodeDecodeFunction · 0.64
TestU32EncodeDecodeBigFunction · 0.64
TestU64EncodeDecodeFunction · 0.64
TestU64EncodeDecodeBigFunction · 0.64
TestI16EncodeDecodeFunction · 0.64
TestI16EncodeDecodeBigFunction · 0.64
TestI32EncodeDecodeFunction · 0.64
TestI32EncodeDecodeBigFunction · 0.64