Skip to main content

ryo_symbol/
lib.rs

1#![warn(missing_docs)]
2//! # ryo-symbol
3//!
4//! Symbol system for Rust codebase - unique identifiers and file path management.
5//!
6//! ## Overview
7//!
8//! This crate provides:
9//! - **SymbolPath**: Rust ecosystem-wide unique symbol identifier (`tokio::sync::Mutex::lock`)
10//! - **SymbolId**: High-performance internal ID (SlotMap-based, O(1) operations)
11//! - **SymbolRegistry**: Central registry for symbol management
12//! - **WorkspaceFilePath**: Self-contained file path with workspace root
13//! - **WorkspacePathResolver**: Path normalization and validation
14//!
15//! ## Design Philosophy
16//!
17//! - Two-layer architecture: `SymbolPath` (external) ↔ `SymbolId` (internal)
18//! - Single source of truth: All symbol operations go through `SymbolRegistry`
19//! - Self-contained paths: `WorkspaceFilePath` can resolve to absolute path without external context
20//!
21//! ## New in this version
22//!
23//! - **ContentCache**: File freshness tracking (hash/mtime)
24//! - **SymbolPath**: Added `from_workspace_file`, `item_in_file`, `nested_in_file` methods
25//! - **FilePathResolver**: SymbolPath → WorkspaceFilePath conversion
26
27// === Public API ===
28mod content_cache;
29mod crate_name;
30mod error;
31mod file_path;
32mod file_resolver;
33mod id;
34mod kind;
35mod metadata;
36mod path;
37mod registry;
38mod resolver;
39mod span;
40mod symbol_ref;
41mod symbol_resolver;
42#[cfg(any(test, feature = "test-utils"))]
43mod test_harness;
44mod use_resolver;
45mod var_scope;
46
47// === Re-exports ===
48pub use content_cache::{CacheEntry, ContentCache, Freshness};
49pub use crate_name::{CrateName, InvalidCrateNameError};
50pub use error::{
51    InvalidSymbolId, ParseError, RegistrationError, RenameError, ResolutionError, ResolveError,
52    UnregisterReexportError,
53};
54pub use file_path::{write_with_parents, WorkspaceFilePath};
55pub use file_resolver::FilePathResolver;
56pub use id::SymbolId;
57// Re-export uuid for persistent identity
58pub use kind::SymbolKind;
59#[cfg(any(test, feature = "test-utils"))]
60pub use metadata::MockMetadataProvider;
61pub use metadata::{
62    CargoMetadataProvider, CrateInfo, MetadataError, TargetInfo, TargetKind,
63    WorkspaceMetadataProvider,
64};
65pub use path::{Segment, SymbolPath, SymbolPathBuilder};
66pub use registry::{MemoryStats, ReExportInfo, SymbolRegistry};
67pub use resolver::{CrateLayout, EntryPoint, WorkspacePathResolver, WorkspaceType};
68pub use span::{FileSpan, Visibility};
69pub use symbol_ref::SymbolRef;
70pub use symbol_resolver::SymbolPathResolver;
71#[cfg(any(test, feature = "test-utils"))]
72pub use test_harness::{TestWorkspace, TestWorkspaceBuilder};
73pub use use_resolver::{ImportMap, UseResolver};
74pub use uuid::Uuid;
75pub use var_scope::VarScope;
76
77// Re-export for convenience
78pub use serde;
79pub use slotmap;