MCPcopy Index your code
hub / github.com/Workiva/go-datastructures / Marshal

Function Marshal

bitarray/encoding.go:28–36  ·  view source on GitHub ↗

Marshal takes a dense or sparse bit array and serializes it to a byte slice.

(ba BitArray)

Source from the content-addressed store, hash-verified

26// Marshal takes a dense or sparse bit array and serializes it to a
27// byte slice.
28func Marshal(ba BitArray) ([]byte, error) {
29 if eba, ok := ba.(*bitArray); ok {
30 return eba.Serialize()
31 } else if sba, ok := ba.(*sparseBitArray); ok {
32 return sba.Serialize()
33 } else {
34 return nil, errors.New("not a valid BitArray")
35 }
36}
37
38// Unmarshal takes a byte slice, of the same format produced by Marshal,
39// and returns a BitArray.

Callers 3

TestUnmarshalErrorsFunction · 0.85

Calls 1

SerializeMethod · 0.45

Tested by 3

TestUnmarshalErrorsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…