Skip to main content

LinkNetwork

Struct LinkNetwork 

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

Mutable links network for CST, AST, semantic, and self-description links.

Implementations§

Source§

impl LinkNetwork

Source

pub const fn new() -> Self

Creates an empty links network.

Source

pub fn self_describing() -> Self

Creates a links network containing the common self-description roots.

Source

pub fn parse( text: &str, language: &str, configuration: ParseConfiguration, ) -> Self

Parses plain source text into a lossless token network.

This is the default parse operation. It is lossless by construction; use LinkNetwork::projected_links when a lower-level view should be stripped away for CST, AST, or semantic-only work.

Source

pub fn parse_lossless_text( text: &str, language: &str, configuration: ParseConfiguration, ) -> Self

Parses plain source text into a lossless token network.

This parser boundary preserves source spans, trivia links, recovery markers, and mixed-region metadata behind the same network representation.

Source

pub fn len(&self) -> usize

Number of links in the network.

Source

pub fn is_empty(&self) -> bool

Whether the network contains no links.

Iterates over links in identifier order.

Iterates over links included in the selected projection.

Source

pub fn reconstruct_text(&self) -> String

Reconstructs source text from non-missing token links ordered by span.

Source

pub fn embedded_regions(&self) -> Vec<EmbeddedRegion>

Returns embedded mixed-language regions discovered during parse.

Returns links matching a structural query.

Source

pub fn insert_point(&mut self, term: &str) -> LinkId

Inserts a self-referential point link for a term.

Source

pub fn insert_object(&mut self, term: &str) -> LinkId

Inserts an object-identity point link.

Source

pub fn insert_relation<const N: usize>( &mut self, references: [LinkId; N], link_type: LinkType, span: SourceSpan, ) -> LinkId

Inserts a relation link with source span metadata.

Source

pub fn insert_field( &mut self, parent: LinkId, label: &str, child: LinkId, ) -> LinkId

Inserts a labeled field relation as a regular link.

Inserts a link from references and metadata.

Source

pub fn insert_concept_mapping( &mut self, concept: &str, language: &str, syntax: &str, ) -> LinkId

Inserts a concept-to-language syntax mapping.

Source

pub fn reconstruct_concept(&self, concept: &str, language: &str) -> Option<&str>

Reconstructs a concept using a target language syntax mapping.

Source

pub fn apply_substitution( &mut self, rule: &SubstitutionRule, ) -> SubstitutionReport

Applies a match-and-substitute rule over exact reference lists.

Returns a link by id.

Source

pub fn find_term(&self, term: &str) -> Option<LinkId>

Finds a self-description or named term link.

Source

pub fn definition_for(&self, id: LinkId) -> Option<&str>

Finds the definition attached to a term link.

Source

pub fn set_span(&mut self, id: LinkId, span: SourceSpan) -> bool

Sets a source span on an existing link.

Source

pub fn set_flags(&mut self, id: LinkId, flags: LinkFlags) -> bool

Sets parse flags on an existing link.

Source

pub fn verify_full_match(&self, region: Option<ByteRange>) -> VerificationReport

Verifies that the selected region has no error or missing links.

Source§

impl LinkNetwork

Source

pub fn snapshot( &self, version: u64, provenance: impl Into<String>, ) -> NetworkSnapshot

Captures the current network as an immutable versioned snapshot.

Trait Implementations§

Source§

impl Clone for LinkNetwork

Source§

fn clone(&self) -> LinkNetwork

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 Debug for LinkNetwork

Source§

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

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

impl Default for LinkNetwork

Source§

fn default() -> LinkNetwork

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

impl Eq for LinkNetwork

Source§

impl PartialEq for LinkNetwork

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for LinkNetwork

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
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, 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.