sexpr

package
v0.0.0-...-6fe4f4e Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 6 Imported by: 0

README

Exercise 12.8 (P347)

The sexpr.Unmarshal function, like json.Marshal, requires the complete input in a byte slice before it can begin decoding. Define a sexpr.Decoder type that, like json.Decoder, allows a sequence of values to be decoded from an io.reader. Change sexpr.Unmarshal to use this new type.

Documentation

Overview

Package sexpr provides a means for converting Go objects to and from S-expressions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(v interface{}) ([]byte, error)

Marshal encodes a Go value in S-expression form.

func Unmarshal

func Unmarshal(data []byte, out interface{}) (err error)

Unmarshal parses S-expression data and populates the variable whose address is in the non-nil pointer out.

Types

type Decoder

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

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

func (*Decoder) Decode

func (d *Decoder) Decode(v interface{}) (err error)

func (*Decoder) More

func (d *Decoder) More() bool

Jump to

Keyboard shortcuts

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