Skip to content

Rust API index

Public functions indexed

This is a navigational API index, not source documentation. It summarizes the main public callable surface of the six reusable library crates in the workspace; command-line and language-server binaries are documented in their dedicated references.

This index reflects v0.49.0, reviewed at committed df4e714, including hierarchical member surfaces, import usage and module refactorings. For the complete signatures and fields, run cargo doc --workspace --no-deps; this hand-maintained index is not an exhaustive replacement for rustdoc. The parser’s strict and tolerant entry points share one grammar; tolerant errors do not imply formatter acceptance. Any thread calling parsing, analysis, or formatting on deeply nested input must provide at least vlog_parser::PARSE_STACK_SIZE (16 MiB) of stack. The CLI and server configure their worker threads accordingly.

Function Purpose
parse_source Tokenize and strictly parse a complete source file
parse_source_tolerant Parse while returning recoverable diagnostics
lexer::tokenize Convert source text into trivia-bearing tokens
parser::parse Strictly parse a prepared token stream
parser::parse_tolerant Tolerantly parse a prepared token stream
Parser::parse_expr Parse one expression from parser state
defines::collect_defines Build a define table from tokens
DefineTable::from_entries Rebuild a define table from persisted entries
DefineTable::entries Return defines in source order
DefineTable::all Return every definition for a macro name
DefineTable::latest Return the last active definition for a name
Type Public surface
LineIndex new, line_count, line_col, utf16_position, offset, line_range
TextRange new, empty, len, is_empty, contains, as_range
Token is_kw, is_sym, is_macro, has_macro_args, is_base_only_number
TokenKind is_keyword
Type Public methods
ImportPath text
Module end_kw
ClassDecl is_interface_class
BindDirective target_path, head
DataType is_implicit, params, inline, name_span, segments
VirtualKw text
CallComments is_empty
WithComments is_empty
Function Purpose
format_source Format a complete source string
format_range Format only items selected by line ranges
verify_equivalence Re-lex and compare normalized tokens, including comments
verify_convergence Confirm a second formatting pass is identical

Config exposes max_width, indent_width, and uvm_utils_indent (default false, new in v0.49.0). Exhaustive struct literals must include the new field; Config { max_width: 120, ..Config::default() } keeps the other defaults.

Function Purpose
doc::text Create a text document node
doc::group Create a width-sensitive group
doc::indent Nest document nodes by one indentation level
doc::concat Concatenate document nodes
doc::join Interleave document nodes with a separator
Printer::print Render a document tree to text
Module/type Public functions and methods
align plan, render, flat_width
fence fence_of, collect, region_at, protected_regions, is_protected
LineRanges new, parse, spans
range select, plan
Function Purpose
run Parse and lint source in one call
lint Run enabled rules against a prepared context with inline waivers
lint_with Apply inline and external waivers and return external usage alongside findings
all_rules Return the complete rule registry
default_rules Return rules enabled for a single-file run
workspace_rules Return defaults plus project-aware semantic rules
rule_by_name Resolve a registered rule by stable name
select_rules Apply select/ignore rule names or severity classes to the registry
rules_named Expand a rule name or severity class to registered rules
module_interfaces Build the module interface facts used by lint oracles
rules_markdown Generate canonical Markdown rule documentation
Type Public surface
ParsedSource parse, lex_error, tokens, file, context
LintContext new, from_parse, with_tab_width, with_line_length, with_options, with_semantics, with_oracle, mentioned_elsewhere, has_oracle, module_interface, package_exports, parsed_cleanly, line_length, options, option_bool, option_int, option_str, option_list, option_is_set, semantics, source, tokens, file, line_index, path, tab_width, line_text, touches_string, comments
MentionOracle Supply mentioned_outside and optional module_interface / package_exports for project-aware checks
Violation new, with_fix
Fix safe, unsafe_fix
Applicability as_str
module function apply_fixes (caller must filter format-fenced edits)
Severity as_str, from_name, describes; classes Error, Warning, Style
RuleOptions new, is_empty, set_raw, set, overlay, is_set, bool, int, str, list
OptionKind / OptionDefault as_str, vocabulary / value, as_written
ExternalWaivers read, parse, absorb, is_empty, unused
WaiverUse merge (aggregate usage across a complete run before reporting unused waivers)
editor settings functions vscode_lint_settings, rule_setting, severity_setting
Function or type Public methods
analyze Build a semantic model for one parsed file
Semantics scopes, symbols, symbols_named, duplicates, references, file_scope, scope, symbol, symbol_at, reference_at, reference_id_at, reference, definition_of, references_of, document_symbols, resolution_counts, member_site, unit_site, instantiable_scope, member_scopes, file_span
Reference resolved, is_external_candidate, is_inherited_candidate
Import path, supplies
Scope lookup_local, extends
Function or type Public methods
WorkspaceIndex build, files, path, file_id, units, member, members_of, members_of_chain, member_unit, member_in, hierarchical_declarations, members_of_chain_in, member_unit_in, instantiations_of, subclasses_of, base_of, instantiations, subclasses, facts_for, defines, find_define, references_to, references_are_ambiguous, files_spelling, files_mentioning, files_naming_in_macros, mentioned_outside, workspace_symbols, units_of, instantiable_units, counts, update_file, update_facts, absorb, remove_file, fingerprint
IndexBuilder new, add_file, add_facts, finish
FileFacts of, from_analysis, words, macro_words, path, encode, decode
DefinitionKey of
resolve_external Resolve unresolved file references against a workspace index
ExternalTarget defs, best
ExternalResolutions get, iter, counts, definition_of
index_order Sort workspace inputs into their deterministic index order
words::harvest / harvest_text / harvest_raw Build the shared identifier census from tokens or source text

Surface::{Connection, Hierarchical} selects the existing interface view or the wider instance-tail view. Hierarchical reads add nets, variables and nested instances without making them legal named port connections.

FACTS_FORMAT is 19 in this snapshot. Cached facts include normal/macro identifier censuses, package re-export edges (the RX group), and declaration/reference surface tags; Def::lines.positions can carry DeclPositions with UTF-16 ranges for file-scope declarations. Any persisted shape or fact-census change needs a codec-version decision so stale caches cannot silently omit answers.

Function or type Purpose
import_usage, import_scopes, unused_imports Shared scope-aware usage analysis consumed by organize-imports and the linter
PackageExports / Exports Package-member oracle and its known/unknown result; implemented by WorkspaceIndex
ImportUse, ImportScope, UnusedImport Usage evidence, scope inputs and unused-import findings

These names are exported both from vlog_semantic::imports and the crate root. Package exports count as use; unresolved or macro-hidden uses keep removal conservative.

Function Purpose
prepare_rename Validate a cursor target and return its editable identity
prepare_rename_here Validate a target from one parsed file before workspace fan-out
rename_name_at Return the spelling used to bound workspace rename inputs
rename Plan local or workspace-aware rename edits
find_references Collect local and cross-file reference locations
Function or type Public methods
expand_wildcard Replace .* with named connections and warnings for unmatched ports
convert_to_ansi Merge a non-ANSI header and body port declarations
add_port Add a port to a module interface
remove_port Remove a port from a module interface
propagate_ports Carry interface changes through instantiations
port_actions Discover valid port refactors at a cursor
may_have_port_action Cheaply preflight whether port actions are possible
port_action_modules Return module names that bound a port action’s workspace inputs
enclosing_module Return the module containing a cursor position
module_definition Find a unique indexed module definition
module_names Search indexed module names
sites_phrase Share the port-action site-count wording with server offers
instantiation_plan Build an instantiation plan from an indexed module
PortAction label
InstantiationPlan instance_name, has_escaped_identifier, render, render_with
RefactorEdit file_count, edit_count, edits_for; fields edits, warnings, created
Function or type Purpose
organize_imports Remove unused imports, merge duplicates and sort a scope’s initial import run
organize_counts, organize_title, imported_packages, unused_imports Action preflight, labels, package source selection and unused-import ranges
extract_site, extract_title, extract_module Preflight selected module items, label the action and plan extraction
ExtractSite, Home Extraction source requirements and destination choice
inline_site, inline_title, inline_module Preflight an instance, label the action and plan body substitution
InlineSite Instance/module identities used to gather inline inputs

Apply a RefactorEdit as one complete operation. Each path in created also has one offset-zero insertion in edits; create those files before applying text edits. Engines do no I/O. Callers must supply every file needed for edits and refusal checks; current inline source-selection and verifier limits are recorded in the repository topology, handshakes 32–33.

Function or type Public methods
config::parse Parse strict lucisv configuration text
Discovery new, for_input, for_file, for_dir
filelist::read Resolve a nested EDA filelist
walk::collect_files Walk inputs with ignores, exclusions and directory-cycle detection; accepts a FnMut(Warning) sink for recoverable failures
walk::is_excluded Test a path against exclusion patterns
Function or type Public methods
atomic::write_atomic Replace contents using an exclusively created per-operation temp file; concurrent replacements publish one whole buffer, last writer wins
content_hash Compute the cache’s FNV-1a content fingerprint
Cache load, disabled, is_clean, record, store