Documentation
¶
Overview ¶
Package postcard exposes go-iroh's Rust-compatible postcard wire codec.
It is a thin re-export of the internal implementation so sibling modules can share one byte-exact codec.
The Go API is not stable before v1 and may change in any v0 release.
Example ¶
package main
import (
"fmt"
"github.com/tmc/go-iroh/postcard"
)
func main() {
type message struct {
Unsigned uint8
Signed int8
Text string
}
in := message{Unsigned: 200, Signed: -1, Text: "hello"}
b, err := postcard.Marshal(in)
if err != nil {
panic(err)
}
var out message
if err := postcard.Unmarshal(b, &out); err != nil {
panic(err)
}
fmt.Println(out, b[:2])
}
Output: {200 -1 hello} [200 255]
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Decoder ¶
type Decoder = internalpostcard.Decoder
type DecoderFrom ¶
type DecoderFrom = internalpostcard.DecoderFrom
type Encoder ¶
type Encoder = internalpostcard.Encoder
type EncoderTo ¶
type EncoderTo = internalpostcard.EncoderTo
type Marshaler ¶
type Marshaler = internalpostcard.Marshaler