func Example_mapStringInterface() { in := map[string]interface{}{"foo": 1, "hello": "world"} b, err := msgpack.Marshal(in) _ = err var out map[string]interface{} err = msgpack.Unmarshal(b, &out) fmt.Printf("%v %#v\n", err, out) // Output: <nil> map[string]interface {}{"foo":1, "hello":"world"} }
func (t *MsgpackTest) BenchmarkStructManual(c *C) { in := t.structForBenchmark2() out := &benchmarkStruct2{} for i := 0; i < c.N; i++ { b, err := msgpack.Marshal(in) if err != nil { panic(err) } err = msgpack.Unmarshal(b, out) if err != nil { panic(err) } } }
func ExampleUnmarshal() { var out bool err := msgpack.Unmarshal([]byte{0xc3}, &out) fmt.Println(err, out) // Output: <nil> true }