text

package
v3.0.1-alpha.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 11 Imported by: 129

Documentation

Overview

Package text supports marshaling Cap'n Proto messages as text based on a schema.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(typeID uint64, s capnp.Struct) (string, error)

Marshal returns the text representation of a struct.

func MarshalList

func MarshalList(typeID uint64, l capnp.List) (string, error)

MarshalList returns the text representation of a struct list.

Types

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

An Encoder writes the text format of Cap'n Proto messages to an output stream.

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

NewEncoder returns a new encoder that writes to w.

func (*Encoder) Encode

func (enc *Encoder) Encode(typeID uint64, s capnp.Struct) error

Encode writes the text representation of s to the stream.

func (*Encoder) EncodeList

func (enc *Encoder) EncodeList(typeID uint64, l capnp.List) error

EncodeList writes the text representation of struct list l to the stream.

func (*Encoder) UseRegistry

func (enc *Encoder) UseRegistry(reg *schemas.Registry)

UseRegistry changes the registry that the encoder consults for schemas from the default registry.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL