pub enum EngineNetwork {
Mutable(LinkNetwork),
ReadOnly(ReadOnlyNetwork),
}Expand description
Access-mode-aware engine handle returned by configured parsing.
This is the runtime boundary where the configured
AccessMode is enforced: a read-only
engine yields a frozen view and rejects EngineNetwork::as_mutable with a
ReadOnlyViolation, while a mutable engine hands back the editable
network.
Variants§
Mutable(LinkNetwork)
An editable network produced under AccessMode::Mutable.
ReadOnly(ReadOnlyNetwork)
A frozen view produced under AccessMode::ReadOnly.
Implementations§
Source§impl EngineNetwork
impl EngineNetwork
Sourcepub fn with_access_mode(network: LinkNetwork, access_mode: AccessMode) -> Self
pub fn with_access_mode(network: LinkNetwork, access_mode: AccessMode) -> Self
Wraps a network according to the supplied access mode.
Sourcepub const fn access_mode(&self) -> AccessMode
pub const fn access_mode(&self) -> AccessMode
The access mode this handle was created with.
Sourcepub const fn is_mutable(&self) -> bool
pub const fn is_mutable(&self) -> bool
Whether this handle permits mutation.
Sourcepub const fn is_read_only(&self) -> bool
pub const fn is_read_only(&self) -> bool
Whether this handle is read-only.
Sourcepub fn network(&self) -> &LinkNetwork
pub fn network(&self) -> &LinkNetwork
Borrows the underlying network for read-only operations regardless of the access mode.
Sourcepub fn as_mutable(&mut self) -> Result<&mut LinkNetwork, ReadOnlyViolation>
pub fn as_mutable(&mut self) -> Result<&mut LinkNetwork, ReadOnlyViolation>
Borrows the network mutably, or fails with a clear diagnostic when the engine is read-only.
§Errors
Returns ReadOnlyViolation when this handle was created under
AccessMode::ReadOnly.
Sourcepub fn into_read_only(self) -> ReadOnlyNetwork
pub fn into_read_only(self) -> ReadOnlyNetwork
Converts this handle into a read-only view, freezing a mutable network.
Sourcepub fn into_mutable(self) -> LinkNetwork
pub fn into_mutable(self) -> LinkNetwork
Converts this handle into an editable network, forking a read-only view.
Methods from Deref<Target = LinkNetwork>§
Sourcepub fn as_read_only(&self) -> ReadOnlyNetwork
pub fn as_read_only(&self) -> ReadOnlyNetwork
Returns a read-only view sharing a clone of this network.
Sourcepub fn render_markup_document(
&self,
language: &str,
document: &FormattingDocument,
) -> String
pub fn render_markup_document( &self, language: &str, document: &FormattingDocument, ) -> String
Renders a language-free FormattingDocument (the concept layer) into
language surface syntax using the seeded per-format templates.
Sourcepub fn translate_markup_document(
&self,
source_language: &str,
target_language: &str,
text: &str,
) -> Option<String>
pub fn translate_markup_document( &self, source_language: &str, target_language: &str, text: &str, ) -> Option<String>
Parses text written in source_language into the language-free concept
layer, then renders it as target_language surface syntax.
This is the cross-format reconstruction substrate: a Markdown document using bold/italic/heading/list/link round-trips to HTML and back through the shared concept ontology.
Sourcepub fn resolve_document_format(
&self,
language: &str,
fragment: &str,
) -> Option<DocumentFormatMatch>
pub fn resolve_document_format( &self, language: &str, fragment: &str, ) -> Option<DocumentFormatMatch>
Resolves a formatting fragment written in language to the shared,
language-free concept it denotes.
Both Markdown **bold** and HTML <strong>bold</strong> resolve to the
one seeded strong concept link. Returns None when the fragment is not
a known formatting construct or the concept set has not been seeded.
Sourcepub fn render_document_format(
&self,
concept: &str,
language: &str,
instance: &DocumentFormatInstance,
) -> Option<String>
pub fn render_document_format( &self, concept: &str, language: &str, instance: &DocumentFormatInstance, ) -> Option<String>
Renders a concept instance into language surface syntax.
Returns None when the concept has no template for the language or a
required attribute is missing from the instance.
Sourcepub fn translate_document_format(
&self,
source_language: &str,
target_language: &str,
fragment: &str,
) -> Option<String>
pub fn translate_document_format( &self, source_language: &str, target_language: &str, fragment: &str, ) -> Option<String>
Translates a single formatting fragment from source_language to
target_language through the shared concept layer.
Sourcepub fn document_formatting_concept(&self, concept: &str) -> Option<LinkId>
pub fn document_formatting_concept(&self, concept: &str) -> Option<LinkId>
Returns the seeded concept link for a formatting concept id, when present.
Sourcepub fn self_description_text(&self) -> String
pub fn self_description_text(&self) -> String
Serializes the seeded self-description roots as LiNo-style definition lines.
Number of network handles sharing one immutable link allocation.
Sourcepub fn interned_string_count(&self, value: &str) -> Option<usize>
pub fn interned_string_count(&self, value: &str) -> Option<usize>
Number of internal handles sharing an interned string value.
Sourcepub fn projected_links(
&self,
projection: NetworkProjection,
) -> impl Iterator<Item = &Link>
pub fn projected_links( &self, projection: NetworkProjection, ) -> impl Iterator<Item = &Link>
Iterates over links included in the selected projection.
Sourcepub fn reconstruct_text(&self) -> String
pub fn reconstruct_text(&self) -> String
Reconstructs source text from non-missing token links ordered by span.
Sourcepub fn embedded_regions(&self) -> Vec<EmbeddedRegion>
pub fn embedded_regions(&self) -> Vec<EmbeddedRegion>
Returns embedded mixed-language regions discovered during parse.
Sourcepub fn query_links(&self, query: &LinkQuery) -> Vec<&Link>
pub fn query_links(&self, query: &LinkQuery) -> Vec<&Link>
Returns links matching a structural query.
Sourcepub fn query_matches(&self, query: &LinkQuery) -> Vec<QueryMatch>
pub fn query_matches(&self, query: &LinkQuery) -> Vec<QueryMatch>
Returns query matches with capture bindings.
Sourcepub fn query_matches_with(
&self,
query: &LinkQuery,
predicate_host: &impl QueryPredicateHost,
) -> Vec<QueryMatch>
pub fn query_matches_with( &self, query: &LinkQuery, predicate_host: &impl QueryPredicateHost, ) -> Vec<QueryMatch>
Returns query matches with host-evaluated predicate support.
Sourcepub fn reconstruct_concept(&self, concept: &str, language: &str) -> Option<&str>
pub fn reconstruct_concept(&self, concept: &str, language: &str) -> Option<&str>
Reconstructs a concept using a target language syntax mapping.
Sourcepub fn find_term(&self, term: &str) -> Option<LinkId>
pub fn find_term(&self, term: &str) -> Option<LinkId>
Finds a self-description or named term link.
Sourcepub fn definition_for(&self, id: LinkId) -> Option<&str>
pub fn definition_for(&self, id: LinkId) -> Option<&str>
Finds the definition attached to a term link.
Sourcepub fn verify_full_match(&self, region: Option<ByteRange>) -> VerificationReport
pub fn verify_full_match(&self, region: Option<ByteRange>) -> VerificationReport
Verifies that the selected region has no error or missing links.
Sourcepub fn to_lino(&self) -> String
pub fn to_lino(&self) -> String
Serializes the entire network to canonical links-notation text.
Every link becomes one statement keyed by its numeric id. The output is
accepted by the [links_notation] crate parser and round-trips back
through LinkNetwork::from_lino.
Sourcepub fn reconstruct_text_as(
&self,
target_language: &str,
configuration: ParseConfiguration,
) -> String
pub fn reconstruct_text_as( &self, target_language: &str, configuration: ParseConfiguration, ) -> String
Reconstructs text for a target language or formalization level.
Natural same-language reconstruction returns the original byte-exact token stream. When semantic proposition links are available, target natural-language text and configured formal representations are rendered through the shared concept mappings.
Sourcepub fn reconstruct_text_as_with_rules(
&self,
target_language: &str,
configuration: ParseConfiguration,
rule_set: &TranslationRuleSet,
) -> String
pub fn reconstruct_text_as_with_rules( &self, target_language: &str, configuration: ParseConfiguration, rule_set: &TranslationRuleSet, ) -> String
Reconstructs text using a caller-supplied translation rule set.
Sourcepub fn reconstruct_text_as_with_registry(
&self,
target_language: &str,
configuration: ParseConfiguration,
registry: &TranslationRuleRegistry,
) -> String
pub fn reconstruct_text_as_with_registry( &self, target_language: &str, configuration: ParseConfiguration, registry: &TranslationRuleRegistry, ) -> String
Reconstructs text through the active rule set in a registry.
Sourcepub fn snapshot(
&self,
version: u64,
provenance: impl Into<String>,
) -> NetworkSnapshot
pub fn snapshot( &self, version: u64, provenance: impl Into<String>, ) -> NetworkSnapshot
Captures the current network as an immutable versioned snapshot.
Sourcepub fn structural_diff(&self, other: &Self) -> StructuralDiff
pub fn structural_diff(&self, other: &Self) -> StructuralDiff
Computes changed, added, and removed link ids against another network.
Sourcepub fn render_source(&self, language: &str) -> String
pub fn render_source(&self, language: &str) -> String
Renders source text for language from a parsed or constructed network.
Parsed networks are rendered from their document root. Hand-built
networks without document links are rendered from top-level syntax or
token links whose metadata language matches language.
Sourcepub fn render_source_from(&self, root: LinkId, language: &str) -> String
pub fn render_source_from(&self, root: LinkId, language: &str) -> String
Renders source text from a specific syntax, document, region, or token link.
Sourcepub fn render_source_from_document(&self, language: &str) -> Option<String>
pub fn render_source_from_document(&self, language: &str) -> Option<String>
Renders source text from document links matching language.
Returns None when the network has no matching document link, which is
common for programmatically constructed syntax fragments.
Sourcepub fn find(&self, query: &LinkQuery) -> Vec<QueryMatch>
pub fn find(&self, query: &LinkQuery) -> Vec<QueryMatch>
Finds query matches using the transform surface’s source-text predicates.
This delegates structural matching to LinkQuery’s S-expression
matcher. Built-in predicates such as #eq? @capture "text" compare the
text reconstructed from captured token links.
Trait Implementations§
Source§impl Clone for EngineNetwork
impl Clone for EngineNetwork
Source§fn clone(&self) -> EngineNetwork
fn clone(&self) -> EngineNetwork
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EngineNetwork
impl Debug for EngineNetwork
Source§impl Deref for EngineNetwork
impl Deref for EngineNetwork
Source§impl LinkStore for EngineNetwork
impl LinkStore for EngineNetwork
Source§fn create(
&mut self,
references: &[LinkId],
metadata: LinkMetadata,
) -> Result<LinkId, StorageError>
fn create( &mut self, references: &[LinkId], metadata: LinkMetadata, ) -> Result<LinkId, StorageError>
Source§fn read(&self, id: LinkId) -> Result<Option<Link>, StorageError>
fn read(&self, id: LinkId) -> Result<Option<Link>, StorageError>
Source§fn update(
&mut self,
id: LinkId,
references: &[LinkId],
metadata: LinkMetadata,
) -> Result<bool, StorageError>
fn update( &mut self, id: LinkId, references: &[LinkId], metadata: LinkMetadata, ) -> Result<bool, StorageError>
Source§fn delete(&mut self, id: LinkId) -> Result<bool, StorageError>
fn delete(&mut self, id: LinkId) -> Result<bool, StorageError>
Source§fn search(&self, query: &LinkStoreQuery) -> Result<Vec<Link>, StorageError>
fn search(&self, query: &LinkStoreQuery) -> Result<Vec<Link>, StorageError>
query. Read moreSource§fn count(&self, query: &LinkStoreQuery) -> Result<usize, StorageError>
fn count(&self, query: &LinkStoreQuery) -> Result<usize, StorageError>
query. Read moreSource§impl PartialEq for EngineNetwork
impl PartialEq for EngineNetwork
impl Eq for EngineNetwork
impl StructuralPartialEq for EngineNetwork
Auto Trait Implementations§
impl Freeze for EngineNetwork
impl RefUnwindSafe for EngineNetwork
impl Send for EngineNetwork
impl Sync for EngineNetwork
impl Unpin for EngineNetwork
impl UnsafeUnpin for EngineNetwork
impl UnwindSafe for EngineNetwork
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more