pub struct LemmaSpecSet {
pub repository: Arc<LemmaRepository>,
pub name: String,
/* private fields */
}Expand description
All spec versions sharing a (repository, name) identity, keyed by effective_from.
The owning LemmaRepository is held by Arc so the set carries repository identity as
a real memory reference instead of relying on string parsing.
Fields§
§repository: Arc<LemmaRepository>§name: StringImplementations§
Source§impl LemmaSpecSet
impl LemmaSpecSet
pub fn new(repository: Arc<LemmaRepository>, name: String) -> Self
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn first(&self) -> Option<&Arc<LemmaSpec>>
Sourcepub fn get_exact(
&self,
effective_from: Option<&DateTimeValue>,
) -> Option<&Arc<LemmaSpec>>
pub fn get_exact( &self, effective_from: Option<&DateTimeValue>, ) -> Option<&Arc<LemmaSpec>>
Exact identity by effective_from key.
Sourcepub fn insert(&mut self, spec: Arc<LemmaSpec>) -> bool
pub fn insert(&mut self, spec: Arc<LemmaSpec>) -> bool
Insert a spec. Returns false if the same effective_from already exists.
Sourcepub fn remove(&mut self, effective_from: Option<&DateTimeValue>) -> bool
pub fn remove(&mut self, effective_from: Option<&DateTimeValue>) -> bool
Remove by effective_from key. Returns whether a row was removed.
pub fn iter_specs(&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 spec paired with its half-open [effective_from, effective_to) range.
effective_from = Noneon the first row means no earlier version exists.effective_to = Noneon the last row means no successor (this is the latest loaded version; its validity is unbounded forward).- Otherwise
effective_toequals the next row’seffective_from(exclusive end of this row’s validity).
Iteration order matches Self::iter_specs (ascending by effective_from).
Sourcepub fn specs_iter(&self) -> impl Iterator<Item = &Arc<LemmaSpec>> + '_
pub fn specs_iter(&self) -> impl Iterator<Item = &Arc<LemmaSpec>> + '_
Borrowed iteration in key order (for planning loops without allocating a Vec).
Sourcepub fn spec_at(&self, effective: &EffectiveDate) -> Option<Arc<LemmaSpec>>
pub fn spec_at(&self, effective: &EffectiveDate) -> Option<Arc<LemmaSpec>>
Spec active at effective. Each spec covers [effective_from, next.effective_from).
The last spec covers [effective_from, +∞).
Sourcepub fn effective_range(
&self,
spec: &Arc<LemmaSpec>,
) -> (Option<DateTimeValue>, Option<DateTimeValue>)
pub fn effective_range( &self, spec: &Arc<LemmaSpec>, ) -> (Option<DateTimeValue>, Option<DateTimeValue>)
Returns the effective range [from, to) for a spec in this set.
from:spec.effective_from()(None = -∞)to: next temporal version’seffective_from, or None (+∞) if no successor.
Sourcepub fn temporal_boundaries(&self) -> Vec<DateTimeValue>
pub fn temporal_boundaries(&self) -> Vec<DateTimeValue>
All effective_from dates, sorted ascending. Specs without effective_from excluded (-∞).
Sourcepub fn effective_dates(
&self,
spec: &Arc<LemmaSpec>,
context: &Context,
) -> Vec<EffectiveDate>
pub fn effective_dates( &self, spec: &Arc<LemmaSpec>, context: &Context, ) -> Vec<EffectiveDate>
Global effective dates filtered to the [eff_from, eff_to) validity range of spec.
Sourcepub fn coverage_gaps(
&self,
required_from: Option<&DateTimeValue>,
required_to: Option<&DateTimeValue>,
) -> Vec<(Option<DateTimeValue>, Option<DateTimeValue>)>
pub fn coverage_gaps( &self, required_from: Option<&DateTimeValue>, required_to: Option<&DateTimeValue>, ) -> Vec<(Option<DateTimeValue>, Option<DateTimeValue>)>
Gaps where this spec set’s specs do not cover [required_from, required_to).
Start: None = −∞, end: None = +∞. Empty result means full coverage.
When the set is empty, the entire required range is one gap.
Trait Implementations§
Source§impl Clone for LemmaSpecSet
impl Clone for LemmaSpecSet
Source§fn clone(&self) -> LemmaSpecSet
fn clone(&self) -> LemmaSpecSet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more