pub struct Context { /* private fields */ }Expand description
Ordered store of specs keyed by (repository, name) and grouped into
LemmaSpecSets.
Specs with the same (repository, name) identity are ordered by effective_from.
A spec version’s temporal end is derived from the successor spec’s effective_from, or
+∞. The repository identity is preserved as Arc<LemmaRepository> — never via string
prefixes on the spec name. Repository names include the @ prefix when present
(e.g. "@org/repo"). Dependency isolation is enforced at insert_spec: all specs
in a repository must share the same dependency provenance ID.
Implementations§
Source§impl Context
impl Context
pub fn new() -> Self
Sourcepub fn workspace(&self) -> Arc<LemmaRepository>
pub fn workspace(&self) -> Arc<LemmaRepository>
Workspace-global grouping for every locally loaded spec. The single
namespace runtime APIs operate on (entry-point specs live here).
Stable identity across calls; name = None, dependency = None.
Sourcepub fn find_repository(&self, name: &str) -> Option<Arc<LemmaRepository>>
pub fn find_repository(&self, name: &str) -> Option<Arc<LemmaRepository>>
Look up a repository by name without creating a new one.
Sourcepub fn repositories(
&self,
) -> &IndexMap<Arc<LemmaRepository>, IndexMap<String, LemmaSpecSet>>
pub fn repositories( &self, ) -> &IndexMap<Arc<LemmaRepository>, IndexMap<String, LemmaSpecSet>>
All spec sets, keyed by (repository, name). Iteration order: repository first
(insertion order), then spec name ascending.
pub fn iter(&self) -> impl Iterator<Item = Arc<LemmaSpec>> + '_
Sourcepub fn iter_with_ranges(
&self,
) -> impl Iterator<Item = (Arc<LemmaSpec>, Option<DateTimeValue>, Option<DateTimeValue>)> + '_
pub fn iter_with_ranges( &self, ) -> impl Iterator<Item = (Arc<LemmaSpec>, Option<DateTimeValue>, Option<DateTimeValue>)> + '_
Every loaded spec paired with its half-open
[effective_from, effective_to) validity range. Iteration order
matches Self::iter.
Sourcepub fn spec_set(
&self,
repository: &Arc<LemmaRepository>,
name: &str,
) -> Option<&LemmaSpecSet>
pub fn spec_set( &self, repository: &Arc<LemmaRepository>, name: &str, ) -> Option<&LemmaSpecSet>
Look up a spec set by (repository, name). Returns None if no such spec set
is loaded.
Sourcepub fn insert_spec(
&mut self,
repository: Arc<LemmaRepository>,
spec: Arc<LemmaSpec>,
) -> Result<(), Error>
pub fn insert_spec( &mut self, repository: Arc<LemmaRepository>, spec: Arc<LemmaSpec>, ) -> Result<(), Error>
Insert a spec under repository. Validates that an identical (repository, name, effective_from)triple is not already loaded. Insert a spec underrepository`. Enforces two invariants:
- Dependency isolation: all specs in a repo must share the same
dependencyprovenance. A workspace repo cannot be merged with a dependency repo, and two different dependencies cannot contribute to the same repo name. - No duplicate
(repository, name, effective_from)triples.
pub fn remove_spec( &mut self, repository: &Arc<LemmaRepository>, spec: &Arc<LemmaSpec>, ) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnsafeUnpin for Context
impl UnwindSafe for Context
Blanket Implementations§
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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