ESC
Type to search...
S
Soli Docs

Rust API catalog — core types and methods

This is the map of types a junior should memorize. It is not rustdoc for every private helper (the crate has thousands of fns). For a symbol not listed here, rg "struct Name" src then read the impl block.

Signatures are simplified. See the source for lifetimes and errors.


Crate root (src/lib.rs)

FunctionRole
run(source)Lex → parse → type-check → tree-walk
run_with_options(source, type_check)Same, toggle checker
run_with_path(source, path, type_check)+ module resolution from path
run_file(path, type_check)Read file, then run_with_path
run_vm / run_file_vmSame front-end, bytecode VM
type_check_sourcesoli check; returns warnings or errors

Lexer

Scanner<'a> (lexer/scanner.rs)

MethodRole
new(source: &str)Bind input
scan_tokens(&mut self) -> Result<Vec<Token>, LexerError>Whole file
scan_token(&mut self) -> Result<Token, LexerError>One token (also used internally)

Token (lexer/token.rs)

Field / methodRole
kind: TokenKindWhat it is
span: SpanWhere it is
new(kind, span)Construct
eof(position, line, column)Sentinel

TokenKind — literals, keywords, operators, SdqlBlock, InterpolatedString, Eof. Add syntax here first.


Parser

Parser (parser/core.rs)

MethodRole
new(tokens: Vec<Token>)Cursor at 0
parse(&mut self) -> ParseResult<Program>Full program

Other impl Parser blocks live in declarations.rs, statements.rs, expressions.rs. They are the same struct.


AST

Expr / Stmt

FieldRole
kindExprKind / StmtKind enum
spanFor errors

Argument

Positional(Expr) | Named(NamedArgument) | Block(Expr)

Program

statements: Vec<Stmt>


Values (interpreter/value.rs)

Value (enum)

See Interpreter for variants.

MethodRole
method(ValueMethod) -> ValueBox a bound method

Equality for == is not always PartialEq on instances — enum instances compare structurally.

DecimalValue

MethodRole
from_str(s, precision)Parse
precision()Scale
value()&Decimal
to_f64()Lossy

HashKey

Hashable hash keys: int, decimal, string, symbol, bool, null.

Function

AST closure: params, body, captured env, name.

NativeFunction

Wraps NativeFn = Rc<dyn Fn(&[Value]) -> Result<Value, String>>.

Class

Name, methods, class methods, superclass, static data (ORM flags hang off this).

Instance

Class pointer + fields (hidden-class slots when possible).


Environment (interpreter/environment.rs)

MethodRole
new()Empty scope
with_builtins_capacity()Pre-sized global
with_enclosing(parent)Child scope
with_enclosing_and_data(...)Child + hash bindings
define / define_or_update / define_constBind
get / get_local / get_constRead
assign / assign_or_defineWrite
is_constconst guard
contains_localThis frame only
enclosing()Parent
get_all_bindings / get_all_variablesDebug / error pages
reset_for_reuse / reset_for_callPool frames on the serve path

Interpreter (executor/mod.rs)

MethodRole
new()Scripts / tests, all builtins
new_for_serve()No test DSL
new_for_migrations()DDL builtins
with_environment(env)Inject env
interpret(&mut self, &Program)Run
global_env()Globals
get_stack_trace()e.backtrace
set_source_path / coverage settersTooling

Evaluation of a single expression is evaluate (crate-visible on the executor), not a public lib API.


VM

Compiler (vm/compiler.rs)

MethodRole
compile(program)Script compile
compile_with_globals(program, names)Serve: known globals
compile_method_standalone(...)One method
emit / emit_jump / patch_jump / emit_loopBytecode
begin_scope / end_scopeLocals
declare_variable / resolve_variable / resolve_local / resolve_upvalueNames
add_constant / emit_constantPool
start_function / finish_functionNested functions
wrap_in_lambdaSubexpression match / comprehensions
begin_loop / emit_break / emit_continue / end_loopLoops

Vm (vm/vm.rs)

MethodRole
new()Empty VM
execute(proto)Run a function proto
run()Dispatch loop
push / pop / peekStack
close_upvaluesCapture locals that outlive the frame

CallFrame

Instruction pointer, stack base, current FunctionProto.

Op (vm/opcode.rs)

One variant per instruction. The run match must stay in sync with the compiler.


Serve

server_constants

FunctionRole
is_production_env()APP_ENV
check_production_boot(dev_mode)Hosts + 32-char secret
resolve_http_workers_from_env()Pool size
using_production_worker_defaultBanner
realtime_worker_splitHTTP vs WS threads
get_mime_typeStatic
generate_etagCache
parse_range_header / read_file_rangeHTTP Range

PRODUCTION_SESSION_SECRET_MIN_LEN = 32.

finish_response(builder, body) (serve/mod.rs)

Safe .body().

CSRF

register_csrf_skip_pattern(pattern) — from Soli skip_csrf.


Database (src/db/)

Type / fnRole
Adapter / parse_adapterpostgres/mysql/sqlite
init_from_app_pathLoad toml/env
ConnectionRegistry::get/resolve/namesMulti-DB
ConnectionSpec::is_sql / labelKind
TLS helpers in tls.rssslmode

Span / errors

Span

new(start, end, line, column) — byte offsets + display line/col.

Errors

LexerError, ParseError, RuntimeError, SolilangError — all carry a span when they can.


CLI (src/cli/ — binary only)

cli::run() matches Command::{Repl, Run, Serve, Test, Lint, Fmt, Check, New, Generate, …}. Add a subcommand in args.rs + commands/.


Where rustdoc still wins

cargo doc --document-private-items --open generates HTML for everything. Use it when you need a private helper. This page is the guided subset.

Adding a method to this catalog

When you add a public type or a method on a type listed here, add a row. Don’t list every fn in model/core.rs — point at the file instead.