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 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.
Click to show internal directories.
Click to hide internal directories.