Skip to main content

SourceMap

Struct SourceMap 

Source
pub struct SourceMap { /* private fields */ }
Expand description

Independently retained mapping from a scoped reader to the original bytes.

This owns only range metadata, never the temporary joined bytes. Keeping it with a callback error preserves provenance after that temporary buffer and its parser-bound view disappear. Projection uses the current query’s work; retained capacity remains charged to the original account.

Implementations§

Source§

impl SourceMap

Source

pub fn try_copy_in<W: Work>(&self, work: &W) -> Result<Self>

Copies source metadata for an independently retained result/error. Capacity and copying are admitted by current work; neither source bytes nor parser/query references are kept. Original/Logical coordinates and physical fragment boundaries remain unchanged after either parser drops.

Source

pub fn coordinates(&self) -> Coordinates

Whether located errors and element spans are physical or logical.

Source

pub fn carrier(&self) -> Span

Honest physical enclosing range, not a claim of contiguous payload.

Source

pub fn project_offset(&self, offset: u64, execution: &impl Work) -> Result<u64>

Maps a reader offset to one original physical point.

A fragment boundary belongs to the next nonempty fragment. EOF maps to the end of the last fragment, including a trailing empty fragment; an empty constructed value maps to its original contents end, before EOC. An out-of-window offset is terminal caller misuse, not document syntax.

Source

pub fn project_span( &self, span: Span, execution: &impl Work, ) -> Result<OwnedVec<Span>>

Maps a reader range to its actual disjoint physical ranges.

The returned capacity is accounted independently. No contiguous span is invented across fragment headers. A zero-length range yields one actual boundary point. Invalid endpoints are refused before work or allocation.

Trait Implementations§

Source§

impl Debug for SourceMap

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.