Expand description
§sora
This crate provides data structures and utilities for working with source maps in Rust.
§Getting Started
ⓘ
use sora::SourceMap;
// Load a source map from a buffer
let sm = SourceMap::from(buf).unwrap();
// Find a mapping at the given position (line 10, column 12)
let found = sm.find_mapping((10, 12)).unwrap();
// Print the found mapping
println!("Found mapping at (10, 12): {found}");
// Expected output: "Found mapping at (10, 12): 10:12 -> 1:6:8"§Overview
§BorrowedSourceMap
BorrowedSourceMap is a source map containing borrowed or owned strings. It allows for efficient parsing and manipulation of source maps, with several methods provided for creating, accessing, and modifying its contents.
§SourceMap
SourceMap is a type alias to BorrowedSourceMap but owns all its internal strings, providing a more straightforward and safe API for users who do not need to manage the lifetimes of the strings manually.
§Position
Position represents a 0-based line and 0-based column in a file.
§Mapping
Mapping presents an item of the mappings in source maps.
§Features
builder: Enables SourceMapBuilder and functions like Mappings::new for manual construction of source maps.index-map: Enables support for index maps, as specified in spec.ignore_list: Enables support for ignoreList.
Structs§
- Borrowed
Source Map BorrowedSourceMapis a source map containing borrowed or owned strings.- Mapping
- Presents an item of the
mappings. - Mapping
Finder MappingFinderis a helper struct for finding mappings within a BorrowedSourceMap.- Mappings
Mappingsis a collection of Mapping entries.- Position
Positionrepresents a zero-based line and zero-based column in a file.- Source
Info - Presents a specific position in a specific source file.
- Source
MapBuilder
Enums§
Type Aliases§
- Parse
Result - Source
Map SourceMapis a type alias to BorrowedSourceMap but owns all its internal strings, providing a more straightforward and safe API for users who do not need to manage the lifetimes of the strings manually.- Validate
Result