Documentation ¶
Overview ¶
Package perunio contains functionality for the serialization of standard Go types.
Index ¶
- Constants
- func Decode(reader io.Reader, values ...interface{}) (err error)
- func Encode(writer io.Writer, values ...interface{}) (err error)
- func EqualBinary(a, b encoding.BinaryMarshaler) (bool, error)
- func EqualEncoding(a, b Encoder) (bool, error)
- type BigInt
- type ByteSlice
- type Decoder
- type Encoder
- type Serializer
Constants ¶
const MaxBigIntLength = 128
MaxBigIntLength defines the maximum length of a big integer. 1024bit -> 128 bytes.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode decodes multiple primitive values from a reader. All passed values must be references, not copies.
func Encode ¶
Encode encodes multiple primitive values into a writer. All passed values must be copies, not references.
func EqualBinary ¶
func EqualBinary(a, b encoding.BinaryMarshaler) (bool, error)
EqualBinary returns whether the binary representation of the two values `a` and `b` are equal. It returns an error when marshalling fails.
func EqualEncoding ¶
EqualEncoding returns whether the two Encoders `a` and `b` encode to the same byteslice or an error when the encoding failed.
Types ¶
type BigInt ¶
BigInt is a serializer big integer.
type ByteSlice ¶
type ByteSlice []byte
ByteSlice is a serializer byte slice.
type Decoder ¶
type Decoder interface { // Decode reads an object from a stream. // If the stream fails, the underlying error is returned. Decode(io.Reader) error }
A Decoder can decode itself from a stream.
type Encoder ¶
type Encoder interface { // Encode writes itself to a stream. // If the stream fails, the underlying error is returned. Encode(io.Writer) error }
An Encoder can encode itself into a stream.
type Serializer ¶
Serializer objects can be serialized into and from streams.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package serializer implements the wire serializer interface using the perunio encoding format.
|
Package serializer implements the wire serializer interface using the perunio encoding format. |
Package test contains test helper functions for running generic tests for types implementing perunio serializer.
|
Package test contains test helper functions for running generic tests for types implementing perunio serializer. |