File: main.go

package info (click to toggle)
golang-github-tinylib-msgp 1.2.0-1~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 764 kB
  • sloc: makefile: 47
file content (30 lines) | stat: -rw-r--r-- 432 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package main

import "github.com/tinylib/msgp/msgp"

type Example struct {
	I int
	S string
}

var buf [64]byte

func main() {
	e := Example{
		I: 1,
		S: "2",
	}

	b := buf[:0]
	b = msgp.AppendMapHeader(b, 2)
	b = msgp.AppendString(b, "i")
	b = msgp.AppendInt(b, e.I)
	b = msgp.AppendString(b, "s")
	b = msgp.AppendString(b, e.S)

	println("done, len(b):", len(b))
	for i := 0; i < len(b); i++ {
		print(b[i], " ")
	}
	println()
}