Skip to main content

Locator

Struct Locator 

Source
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: u32

Implementations§

Source§

impl Locator

Source

pub fn new<S: AsRef<str>>( source: S, from_line: u32, from_column: u32, to_line: u32, to_column: u32, ) -> Self

Source

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.

Source

pub fn new_range(from: Locator, to: Locator) -> Option<Locator>

creates a new locator range from a given start and end

Source

pub fn is_range(&self) -> bool

Source

pub fn get_short_source(&self, string_source: &str) -> String

Source

pub fn get_source(&self) -> SymStr

Source

pub fn get_from_locator(&self) -> Locator

Source

pub fn get_to_locator(&self) -> Locator

Source§

impl Locator

Source

pub fn to_attribute(&self) -> String

Source

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§

Source§

impl Clone for Locator

Source§

fn clone(&self) -> Locator

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Locator

Source§

impl Debug for Locator

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Locator

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for Locator

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for Locator

Source§

impl From<Locator> for Stored

Source§

fn from(value: Locator) -> Self

Converts to this type from the input type.
Source§

impl Object for Locator

Source§

fn get_locator(&self) -> Option<Locator>

getting the locator of a locator should return itself

Source§

fn stringify(&self) -> String

Source§

fn isa_box(&self) -> bool

Source§

fn is_expandable(&self) -> bool

Source§

fn is_definition(&self) -> bool

Source§

fn is_comment(&self) -> bool

Source§

fn be_digested(self) -> Result<Digested>
where Self: Sized + Debug,

Source§

fn revert(&self) -> Result<Tokens>

each concrete object needs to provide its own path back to tokens
Source§

impl PartialEq for Locator

Source§

fn eq(&self, other: &Locator) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Locator

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.