Skip to main content

ryo_analysis/symbol/
file_id.rs

1//! FileId - Internal high-speed file identifier.
2//!
3//! Uses SlotMap for O(1) operations with generation counting for dangling detection.
4
5use slotmap::new_key_type;
6
7new_key_type! {
8    /// Internal file identifier for fast processing.
9    ///
10    /// # Properties
11    /// - O(1) comparison and hashing
12    /// - Generation counter for dangling detection
13    /// - 8 bytes fixed size
14    ///
15    /// # Important: Only obtain through FileRegistry
16    ///
17    /// FileId must always be obtained through `FileRegistry::register()` or
18    /// `FileRegistry::lookup()`. Direct creation is prohibited.
19    ///
20    /// ```rust,ignore
21    /// // Correct usage
22    /// let id = file_registry.register(path, crate_name);
23    /// let id = file_registry.lookup(&path)?;
24    ///
25    /// // Prohibited: Direct creation
26    /// // let id = FileId::default();  // Compiles but prohibited
27    /// ```
28    pub struct FileId;
29}