MCPcopy
hub / github.com/rs/zerolog / AppendStringers

Method AppendStringers

internal/cbor/string.go:37–49  ·  view source on GitHub ↗

AppendStringers encodes and adds an array of Stringer values to the dst byte array.

(dst []byte, vals []fmt.Stringer)

Source from the content-addressed store, hash-verified

35// AppendStringers encodes and adds an array of Stringer values
36// to the dst byte array.
37func (e Encoder) AppendStringers(dst []byte, vals []fmt.Stringer) []byte {
38 if vals == nil || len(vals) == 0 {
39 return e.AppendArrayEnd(e.AppendArrayStart(dst))
40 }
41 dst = e.AppendArrayStart(dst)
42 dst = e.AppendStringer(dst, vals[0])
43 if len(vals) > 1 {
44 for _, val := range vals[1:] {
45 dst = e.AppendStringer(dst, val)
46 }
47 }
48 return e.AppendArrayEnd(dst)
49}
50
51// AppendStringer encodes and adds the Stringer value to the dst
52// byte array.

Callers 3

StringersMethod · 0.45
StringersMethod · 0.45
TestAppendStringersFunction · 0.45

Calls 3

AppendArrayEndMethod · 0.95
AppendArrayStartMethod · 0.95
AppendStringerMethod · 0.95

Tested by 1

TestAppendStringersFunction · 0.36