Module v.reflection stdlib

v.reflection
Version:
0.3.3
License:
MIT
Dependencies from vmod:
0
Imports:
1
Imported by:
0
Repository:
OS-specific
Show selected OS-specific symbols.
Backend-specific
Show selected Backend-specific symbols.

Dependencies defined in v.mod

This section is empty.

Imports

Imported by

This section is empty.

Aliases

This section is empty.

Constants

This section is empty.

Sum types

#type TypeInfo

pub type TypeInfo = Alias

Functions

#fn get_aliases

fn get_aliases() []Type

get_aliases returns the registered aliases

#fn get_enums

fn get_enums() []Type

get_enums returns the registered enums

#fn get_funcs

fn get_funcs() []Function

get_functions returns the functions built with V source

#fn get_interfaces

fn get_interfaces() []Interface

get_interfaces returns the registered aliases

#fn get_modules

fn get_modules() []Module

get_modules returns the module name built with V source

#fn get_string_by_idx

fn get_string_by_idx(idx int) string

#fn get_structs

fn get_structs() []Type

#fn get_sum_types

fn get_sum_types() []Type

get_sum_types returns the registered sum types

#fn get_type

fn get_type(idx int) ?Type

#fn get_type_symbol

fn get_type_symbol(idx int) ?TypeSymbol

#fn get_type_symbols

fn get_type_symbols() []TypeSymbol

get_type_symbol returns the registered type symbols

#fn get_types

fn get_types() []Type

get_types returns the registered types

#fn type_name

fn type_name(idx int) string

Type API

#fn type_of[T]

fn type_of[T](val T) Type

type_of returns the type info of the passed value

#fn type_symbol_name

fn type_symbol_name(idx int) string

Type Symbol API

Structs

#struct Reflection

heapminify
pub struct Reflection {
pub mut:
	modules      []Module
	funcs        []Function
	types        []Type
	type_symbols []TypeSymbol
	enums        []Enum
	interfaces   []Interface
	strings      map[int]string
}

#struct ArrayFixed

pub struct ArrayFixed {
pub:
	size      int // array size
	elem_type int // elem type idx
}

#struct Array

pub struct Array {
pub:
	nr_dims   int // nr of dimensions
	elem_type int // elem type idx
}

#struct Alias

pub struct Alias {
pub:
	parent_idx int       // parent type idx
	language   VLanguage // language
}

#struct Interface

pub struct Interface {
pub:
	name       string        // interface name
	methods    []Function    // methods
	fields     []StructField // fields
	is_generic bool // is generic?
}

#struct None

pub struct None {
pub:
	parent_idx int
}

#struct Enum

pub struct Enum {
pub:
	vals    []string // enum values
	is_flag bool     // is flag?
}

#struct StructField

pub struct StructField {
pub:
	name   string   // field name
	typ    VType    // type
	attrs  []string // field attrs
	is_pub bool     // is pub?
	is_mut bool     // is mut?
}

#struct Struct

pub struct Struct {
pub:
	parent_idx int           // parent type
	attrs      []string      // struct attrs
	fields     []StructField // fields
}

#struct SumType

pub struct SumType {
pub:
	parent_idx int     // parent type
	variants   []VType // variant type
}

#struct Map

pub struct Map {
pub:
	key_type   VType // key type
	value_type VType // value type
}

#struct MultiReturn

pub struct MultiReturn {
pub:
	types []VType // types
}

#struct TypeSymbol

pub struct TypeSymbol {
pub:
	name       string     // symbol name
	idx        int        // symbol idx
	parent_idx int        // symbol parent idx
	language   VLanguage  // language
	kind       VKind      // kind
	info       TypeInfo   // info
	methods    []Function // methods
}

#struct Type

pub struct Type {
pub:
	name string     // type name
	idx  int        // type idx
	sym  TypeSymbol // type symbol
}

#struct Module

pub struct Module {
pub:
	name string // module name
}

#struct FunctionArg

pub struct FunctionArg {
pub:
	name   string // argument name
	typ    VType  // argument type idx
	is_mut bool   // is mut?
}

#struct Function

pub struct Function {
pub:
	mod_name     string        // module name
	name         string        // function/method name
	args         []FunctionArg // function/method args
	file_idx     int   // source file name
	line_start   int   // decl start line
	line_end     int   // decl end line
	is_variadic  bool  // is variadic?
	return_typ   VType // return type idx
	receiver_typ VType // receiver type idx (is a method)
	is_pub       bool  // is pub?
}

Interfaces

This section is empty.

Enums

#enum VLanguage

pub enum VLanguage {
	v
	c
	js
	amd64 // aka x86_64
	i386
	arm64 // 64-bit arm
	arm32 // 32-bit arm
	rv64 // 64-bit risc-v
	rv32 // 32-bit risc-v
	wasm32
}

#enum VTypeFlag

pub enum VTypeFlag {
	option
	result
	variadic
	generic
	shared_f
	atomic_f
}

max of 8

#enum VKind

pub enum VKind {
	placeholder
	void
	voidptr
	byteptr
	charptr
	i8
	i16
	int
	i64
	isize
	u8
	u16
	u32
	u64
	usize
	f32
	f64
	char
	rune
	bool
	none_
	string
	array
	array_fixed
	map
	chan
	any
	struct_
	generic_inst
	multi_return
	sum_type
	alias
	enum_
	function
	interface_
	float_literal
	int_literal
	aggregate
	thread
}