A Rust library for compact and efficient source file mapping and position tracking. Designed to support source code analysis, debugging tools, and development environments.
- Compact file ID representation
- Absolute and relative source position tracking
- Flexible file ID types (supports
u8
andu16
) - Optional runtime feedback
- Source code view capabilities
- Create absolute positions with file references
- Create relative positions without file context
- Support for line and column tracking
- Add files with byte content
- Map file paths to numeric IDs
- Retrieve file contents by ID
use sourcier::sfm::{SourceFilesMap, create_absolute_position};
// Create a file map with u8 file IDs
let mut files = SourceFilesMap::<u8>::new();
// Add files
files.add_file("src/main.rs".to_string(), Vec::new());
files.finalize().unwrap();
// Get file ID
let file_id = files.get_id("src/main.rs").unwrap();
// Create an absolute position
let position = create_absolute_position(file_id, 10, 5, 12, 20);
u8
: Supports up to 255 filesu16
: Supports up to 65,535 files
rt-feedback
: Runtime usage trackingview
: Source code viewing capabilities
- Compact memory representation
- Efficient line and column tracking
- Minimal overhead for source position management
- Stabilize API
- Comprehensive documentation
- More extensive testing
- Performance benchmarks
- Additional file ID type support
🚨 Important Notice
This library is currently not available on crates.io.
To use this library, you'll need to reference it directly from the GitHub repository:
[dependencies]
sourcier = { git = "https://github.com./elcoosp/sourcier", branch = "main" }
Contributions are welcome! Please be aware that the library is in early stages and the API is likely to change significantly.
[To be determined - specify your license]
This library is experimental. Do not use in production environments until further notice.