rstypes

package
v0.1.4 Latest Latest
Warning

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

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

Documentation

Overview

Package types contains structs/interfaces representing Rust types

Package types contains structs/interfaces representing Rust types

Package types contains structs/interfaces representing Rust types

Package types contains structs/interfaces representing Rust types

Package types contains structs/interfaces representing Rust types

Package types contains structs/interfaces representing Rust types

Package types contains structs/interfaces representing Rust types

Package types contains structs/interfaces representing Rust types

Package types contains structs/interfaces representing Rust types

Package types contains structs/interfaces representing Rust types

Package types contains structs/interfaces representing Rust types

Package types contains structs/interfaces representing Rust types

Package types contains structs/interfaces representing Rust types

Package types contains structs/interfaces representing Rust types

Package types contains structs/interfaces representing Rust types

Package types contains structs/interfaces representing Rust types

Package types contains structs/interfaces representing Rust types

Package types contains structs/interfaces representing Rust types

Package types contains structs/interfaces representing Rust types

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Any

type Any struct {
	Common
}

Any represents a dynamic type in Rust (dyn Any)

func (*Any) String added in v0.1.2

func (a *Any) String() string

String returns this type in string representation

func (*Any) UsedAsMapKey added in v0.1.2

func (a *Any) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map. dyn Any cannot be used as a map key since it doesn't implement Hash/Eq.

type Array

type Array struct {
	Common
	Inner Type
	Size  uint64 // Size of the fixed array
}

Array represents a fixed-size array type in Rust ([T; N])

func (*Array) String added in v0.1.2

func (a *Array) String() string

String returns this type in string representation

func (*Array) UsedAsMapKey added in v0.1.2

func (a *Array) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as a map key. Arrays cannot be used as map keys since they don't implement Hash/Eq.

type Boolean

type Boolean struct {
	Common
}

Boolean - boolean in Rust

func (*Boolean) String added in v0.1.2

func (b *Boolean) String() string

String returns this type in string representation

func (*Boolean) UsedAsMapKey added in v0.1.2

func (b *Boolean) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type Common

type Common struct {
	// PkgName is the package name declared at the beginning of .go files.
	// Currently, only exported types in the root package is available.
	PkgName  string
	Position *token.Position
}

Common defines common fields in the all types

func (*Common) GetPackageName added in v0.1.2

func (c *Common) GetPackageName() string

GetPackageName returns PkgName in Common

func (*Common) GetPosition added in v0.1.2

func (c *Common) GetPosition() *token.Position

GetPosition returns Position in Common

func (*Common) SetPackageName added in v0.1.2

func (c *Common) SetPackageName(pkgName string)

SetPackageName sets PkgName in Common

func (*Common) SetPosition added in v0.1.2

func (c *Common) SetPosition(pos *token.Position)

SetPosition sets Position in Common

type Date

type Date struct {
	Common
}

Date - RFC3399 string in Rust

func (*Date) String added in v0.1.2

func (*Date) String() string

String returns this type in string representation

func (*Date) UsedAsMapKey added in v0.1.2

func (*Date) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type Enum added in v0.1.2

type Enum struct {
	Common
	Name string

	Variants map[string]EnumVariant
}

Enum - enum in Rust

func (*Enum) SetName added in v0.1.2

func (e *Enum) SetName(name string)

SetName sets an alternative name

func (*Enum) String added in v0.1.2

func (e *Enum) String() string

String returns this type in string representation

func (*Enum) UsedAsMapKey added in v0.1.2

func (e *Enum) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type EnumVariant added in v0.1.2

type EnumVariant struct {
	RawName    string
	RawTag     string
	FieldIndex int

	Type     Type
	Position *token.Position
}

EnumVariant represents a variant in an enum

type Enumerable

type Enumerable interface {
	Type

	// AddCandidates adds a candidate for enum
	AddCandidates(key string, v interface{})
}

Enumerable interface represents union types

type Function added in v0.1.2

type Function struct {
	Common
	Name     string
	IsMethod bool
	IsAsync  bool
	Params   []FunctionParam // Changed from map to slice to preserve order
	Returns  Type            // Changed from ReturnVal for consistency
	Receiver Type            // For methods, represents self type
}

Function represents a function or method in Rust

func (*Function) SetName added in v0.1.2

func (f *Function) SetName(name string)

SetName sets an alternative name

func (*Function) String added in v0.1.2

func (f *Function) String() string

func (*Function) UsedAsMapKey added in v0.1.2

func (f *Function) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type FunctionParam added in v0.1.2

type FunctionParam struct {
	Name     string
	Type     Type
	Position *token.Position
}

FunctionParam represents a parameter in a function

type Map

type Map struct {
	Common
	Key   Type
	Value Type
}

Map represents a HashMap<K,V> type in Rust

func (*Map) String added in v0.1.2

func (m *Map) String() string

String returns this type in string representation

func (*Map) UsedAsMapKey added in v0.1.2

func (m *Map) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as a map key. Maps cannot be used as map keys since they don't implement Hash/Eq.

type NamedType

type NamedType interface {
	Type

	// SetName sets an alternative name
	SetName(name string)
}

NamedType interface represents named types

type Nullable

type Nullable struct {
	Common
	Inner Type
}

Nullable - ... i.e. Option in Rust

func (*Nullable) String added in v0.1.2

func (e *Nullable) String() string

String returns this type in string representation

func (*Nullable) UsedAsMapKey added in v0.1.2

func (e *Nullable) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type Number

type Number struct {
	Common
	Name    string
	RawType types.BasicKind

	// For enum variants
	Enum    []int64
	RawEnum []RawNumberEnumCandidate

	// Rust numeric type
	IsFloat   bool
	IsSigned  bool
	BitSize   int
	IsUnsized bool // For isize/usize
}

Number - numeric types in Rust

func (*Number) AddCandidates added in v0.1.2

func (e *Number) AddCandidates(key string, v interface{})

AddCandidates adds an candidate for enum

func (*Number) SetName added in v0.1.2

func (e *Number) SetName(name string)

SetName sets an alternative name

func (*Number) String added in v0.1.2

func (e *Number) String() string

String returns this type in string representation

func (*Number) UsedAsMapKey added in v0.1.2

func (e *Number) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type Primitive added in v0.1.2

type Primitive struct {
	Common
	Name string
}

Primitive represents primitive types in Rust

func (*Primitive) String added in v0.1.2

func (p *Primitive) String() string

func (*Primitive) UsedAsMapKey added in v0.1.2

func (p *Primitive) UsedAsMapKey() bool

type RawNumberEnumCandidate

type RawNumberEnumCandidate struct {
	Key   string
	Value interface{}
}

RawNumberEnumCandidate represents a raw candidate for number enum

type RawStringEnumCandidate

type RawStringEnumCandidate struct {
	Key   string
	Value string
}

RawStringEnumCandidate represents a raw candidate for string enum

type Result added in v0.1.2

type Result struct {
	Common
	Ok  Type
	Err Type
}

Result - Result<T, E> in Rust

func (*Result) String added in v0.1.2

func (e *Result) String() string

String returns this type in string representation

func (*Result) UsedAsMapKey added in v0.1.2

func (e *Result) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type Stream added in v0.1.2

type Stream struct {
	Common
	Name  string
	Inner Type
}

Stream - stream in Rust

func (*Stream) SetName added in v0.1.2

func (s *Stream) SetName(name string)

SetName sets an alternative name

func (*Stream) String added in v0.1.2

func (s *Stream) String() string

String returns this type in string representation

func (*Stream) UsedAsMapKey added in v0.1.2

func (s *Stream) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type String

type String struct {
	Common
	Name    string
	Enum    []string                 // Possible enum variants
	RawEnum []RawStringEnumCandidate // Raw enum data with keys
}

String represents a Rust String type, which can optionally be an enum

func (*String) AddCandidates added in v0.1.2

func (s *String) AddCandidates(key string, value interface{})

AddCandidates adds a candidate variant to the string enum

func (*String) SetName added in v0.1.2

func (s *String) SetName(name string)

SetName sets the type name for this string

func (*String) String added in v0.1.2

func (s *String) String() string

String returns a string representation of this type

func (*String) UsedAsMapKey added in v0.1.2

func (s *String) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as a map key. Only non-enum strings can be used as map keys.

type Struct added in v0.1.2

type Struct struct {
	Common
	Name string

	Fields map[string]StructField
}

Struct - struct in Rust

func (*Struct) SetName added in v0.1.2

func (n *Struct) SetName(name string)

SetName sets an alternative name

func (*Struct) String added in v0.1.2

func (n *Struct) String() string

String returns this type in string representation

func (*Struct) UsedAsMapKey added in v0.1.2

func (n *Struct) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type StructField added in v0.1.2

type StructField struct {
	RawName    string
	RawTag     string
	FieldIndex int

	Type     Type
	Position *token.Position
	Optional bool
}

StructField is a field in structs

type Trait added in v0.1.2

type Trait struct {
	Common
	Name string
}

Trait - trait in Rust

func (*Trait) String added in v0.1.2

func (t *Trait) String() string

String returns this type in string representation

func (*Trait) UsedAsMapKey added in v0.1.2

func (t *Trait) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type Tuple added in v0.1.2

type Tuple struct {
	Common
	Name  string
	Types []Type
}

Tuple - tuple in Rust

func (*Tuple) SetName added in v0.1.2

func (t *Tuple) SetName(name string)

SetName sets an alternative name

func (*Tuple) String added in v0.1.2

func (t *Tuple) String() string

String returns this type in string representation

func (*Tuple) UsedAsMapKey added in v0.1.2

func (t *Tuple) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type Type

type Type interface {
	SetPackageName(pkgName string)
	GetPackageName() string
	UsedAsMapKey() bool
	String() string
	SetPosition(pos *token.Position)
	GetPosition() *token.Position
}

Type interface represents all Rust types handled by go-easyparser

type Unit added in v0.1.2

type Unit struct {
	Common
}

Unit - unit type () in Rust

func (*Unit) String added in v0.1.2

func (u *Unit) String() string

String returns this type in string representation

func (*Unit) UsedAsMapKey added in v0.1.2

func (u *Unit) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as the key for map

type Vec added in v0.1.2

type Vec struct {
	Common
	Inner Type
}

Vec represents a dynamic array type in Rust (Vec<T>)

func (*Vec) String added in v0.1.2

func (v *Vec) String() string

String returns this type in string representation

func (*Vec) UsedAsMapKey added in v0.1.2

func (v *Vec) UsedAsMapKey() bool

UsedAsMapKey returns whether this type can be used as a map key. Vecs cannot be used as map keys since they don't implement Hash/Eq.

Jump to

Keyboard shortcuts

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