parser

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoType = errors.New("type line not found")

Functions

func TransformNameGo

func TransformNameGo(s string) string

TransformNameGo transforms conventional Rust naming to conventional Go naming.

Example: TransformNameGo("post_id") // returns "PostID"

func TransformTypeGo

func TransformTypeGo(t string) string

TransformTypeGo transforms Rust types to Go

Example: TransformTypeGo("Option<Vec<i64>>") // returns "Optional[[]int64]"

Types

type Enum

type Enum struct {
	Name    string
	Members []Member
}

type Field

type Field struct {
	OrigName string
	Name     string
	Type     string
}

type ImplParser

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

func NewImpl

func NewImpl(r io.Reader) *ImplParser

func (*ImplParser) Parse

func (i *ImplParser) Parse() (map[string]string, error)

func (*ImplParser) Reset

func (i *ImplParser) Reset(r io.Reader)

type Item

type Item struct {
	Struct *Struct
	Enum   *Enum
}

type Member

type Member string

type Route

type Route struct {
	Path   string
	Method string
	Struct string
}

type RoutesParser

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

func NewRoutes

func NewRoutes(r io.Reader) *RoutesParser

func (*RoutesParser) Parse

func (r *RoutesParser) Parse() ([]Route, error)

func (*RoutesParser) Reset

func (r *RoutesParser) Reset(rd io.Reader)

type Struct

type Struct struct {
	Name   string
	Fields []Field
}

type StructParser

type StructParser struct {
	Skip          []string
	TransformName func(string) string
	TransformType func(string) string
	// contains filtered or unexported fields
}

func NewStruct

func NewStruct(r io.Reader) *StructParser

func (*StructParser) Parse

func (s *StructParser) Parse() ([]Item, error)

func (*StructParser) Reset

func (s *StructParser) Reset(r io.Reader)

Jump to

Keyboard shortcuts

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