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

Method AppendString

internal/cbor/string.go:22–33  ·  view source on GitHub ↗

AppendString encodes and adds a string to the dst byte array.

(dst []byte, s string)

Source from the content-addressed store, hash-verified

20
21// AppendString encodes and adds a string to the dst byte array.
22func (Encoder) AppendString(dst []byte, s string) []byte {
23 major := majorTypeUtf8String
24
25 l := len(s)
26 if l <= additionalMax {
27 lb := byte(l)
28 dst = append(dst, major|lb)
29 } else {
30 dst = appendCborTypePrefix(dst, majorTypeUtf8String, uint64(l))
31 }
32 return append(dst, s...)
33}
34
35// AppendStringers encodes and adds an array of Stringer values
36// to the dst byte array.

Callers 6

AppendKeyMethod · 0.95
AppendStringsMethod · 0.95
AppendStringerMethod · 0.95
AppendInterfaceMethod · 0.95
AppendTypeMethod · 0.95
AppendDurationMethod · 0.95

Calls 1

appendCborTypePrefixFunction · 0.85

Tested by

no test coverage detected