Crate sora

Source
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§

BorrowedSourceMap
BorrowedSourceMap is a source map containing borrowed or owned strings.
Mapping
Presents an item of the mappings.
MappingFinder
MappingFinder is a helper struct for finding mappings within a BorrowedSourceMap.
Mappings
Mappings is a collection of Mapping entries.
Position
Position represents a zero-based line and zero-based column in a file.
SourceInfo
Presents a specific position in a specific source file.
SourceMapBuilder

Enums§

ParseError
ValidateError

Type Aliases§

ParseResult
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.
ValidateResult