pub struct Locator {
pub source: SymStr,
pub from_line: u32,
pub to_line: u32,
pub from_column: u32,
pub to_column: u32,
}Fields§
§source: SymStr§from_line: u32§to_line: u32§from_column: u32§to_column: u32Implementations§
Source§impl Locator
impl Locator
pub fn new<S: AsRef<str>>( source: S, from_line: u32, from_column: u32, to_line: u32, to_column: u32, ) -> Self
Sourcepub fn from_sym(
source: SymStr,
from_line: u32,
from_column: u32,
to_line: u32,
to_column: u32,
) -> Self
pub fn from_sym( source: SymStr, from_line: u32, from_column: u32, to_line: u32, to_column: u32, ) -> Self
Locator::new with an already-interned source. Locator::new re-pins
the source string (an interner hash probe over the whole path) on every
call, which is real cost on paths that build locators per token / per
conditional — a Mouth pins its source ONCE at construction and builds
locators from the cached symbol. Same parameter order as new.
Sourcepub fn new_range(from: Locator, to: Locator) -> Option<Locator>
pub fn new_range(from: Locator, to: Locator) -> Option<Locator>
creates a new locator range from a given start and end
pub fn is_range(&self) -> bool
pub fn get_short_source(&self, string_source: &str) -> String
pub fn get_source(&self) -> SymStr
pub fn get_from_locator(&self) -> Locator
pub fn get_to_locator(&self) -> Locator
Source§impl Locator
impl Locator
pub fn to_attribute(&self) -> String
Sourcepub fn to_sourcepos(&self, tag: u32) -> String
pub fn to_sourcepos(&self, tag: u32) -> String
Serialise as a compact, web-facing data-sourcepos value:
tag:line:col-tag:line:col for a range, tag:line:col for a point.
This is the source-map feature’s serialiser (issues #47/#92) — the
brief, sibling-aligned form documented in docs/performance/SOURCE_PROVENANCE.md
§0/§0.1, deliberately not the XPointer to_attribute() above
(which has zero web-platform support and is latent in the port).
tag is the source’s index in the document-level sources table
(Source-Map-v3 style) — never an inlined path, so the markup stays
tiny and is anonymisable. The file is first-class in each endpoint;
a Locator currently carries a single source (so both endpoints
share tag), but the endpoint-complete form future-proofs a
per-endpoint-source Locator.
Trait Implementations§
impl Copy for Locator
impl Eq for Locator
Source§impl Object for Locator
impl Object for Locator
Source§fn get_locator(&self) -> Option<Locator>
fn get_locator(&self) -> Option<Locator>
getting the locator of a locator should return itself