ryo-symbol 0.1.0

Symbol system for Rust codebase - unique identifiers and file path management
Documentation

ryo-symbol

crates.io docs.rs License: MIT OR Apache-2.0

Status: stable. Part of the ryo workspace — AST-centric Rust programming for AI agents.

Symbol system for Rust codebases: unique identifiers, file paths, and a central registry. The two-layer design pairs SymbolPath (external, ecosystem-wide unique like tokio::sync::Mutex::lock) with SymbolId (internal, SlotMap-backed for O(1) ops). All operations go through SymbolRegistry as the single source of truth.

Install

cargo add ryo-symbol

Optional features: test-utils (extra TestHarness helpers), schemars (JSON Schema derive).

Quickstart

use ryo_symbol::{SymbolPath, SymbolRegistry, SymbolKind};

let path = SymbolPath::parse("tokio::sync::Mutex").unwrap();
let mut registry = SymbolRegistry::new();
let id = registry.register(path, SymbolKind::Struct).unwrap();

// Fast O(1) lookup
let resolved = registry.resolve(id);
assert!(resolved.is_some());

API Summary

Type Purpose
SymbolPath Ecosystem-wide unique identifier (external)
SymbolId Internal SlotMap key with generation counter
SymbolRegistry Central registry for symbol lifecycle
WorkspaceFilePath Self-contained file path with workspace root
WorkspacePathResolver Path normalization / validation
ContentCache File freshness tracking (hash / mtime)

See the crate docs for the full module index.

Status

API surface considered stable for the v0.1.0 release. New helpers (from_workspace_file, item_in_file, nested_in_file) added in this version.

License

Licensed under either of Apache-2.0 or MIT at your option.