text

package
v2.18.2+incompatible Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: MIT Imports: 10 Imported by: 0

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) SetIndent

func (enc *Encoder) SetIndent(indent string)

SetIndent sets string to indent each level with. An empty string disables indentation.

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