cast

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package cast provides AST templating utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cast

type Cast interface {
	File() (*ast.File, *token.FileSet)
}

Cast describes a generic AST template.

type Serialized

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

Serialized is byte buffer baked AST template.

func FromAST

func FromAST(filename string, file *ast.File) *Serialized

FromAST creates a new serialized AST template from given AST. If the AST template is invalid, this function can panic.

func FromRe

func FromRe(filename string, src io.Reader) (*Serialized, error)

FromRe creates a new serialized AST template from given byte source. Returns any error encountered.

func MustFromRe

func MustFromRe(filename string, src io.Reader) *Serialized

MustFromRe creates a serialized AST from given byte source. Panics on error

func (*Serialized) AST

func (cast *Serialized) AST() (*ast.File, *token.FileSet)

AST return the internal AST template.

func (*Serialized) Name

func (cast *Serialized) Name() string

Name returns the filename of the serialized template.

func (*Serialized) Reader

func (cast *Serialized) Reader() *bytes.Reader

Reader returns the template as a byte reader.

Jump to

Keyboard shortcuts

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