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
Sourcepub fn get_exact(
&self,
effective_from: Option<&DateTimeValue>,
) -> Option<&LemmaSpec>
pub fn get_exact( &self, effective_from: Option<&DateTimeValue>, ) -> Option<&LemmaSpec>
Exact identity by effective_from key.
Sourcepub fn insert(&mut self, spec: LemmaSpec) -> bool
pub fn insert(&mut self, spec: 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 = &LemmaSpec> + '_
Sourcepub fn iter_with_ranges(
&self,
) -> impl Iterator<Item = (&LemmaSpec, Option<DateTimeValue>, Option<DateTimeValue>)> + '_
pub fn iter_with_ranges( &self, ) -> impl Iterator<Item = (&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 spec_at(&self, effective: &EffectiveDate) -> Option<&LemmaSpec>
pub fn spec_at(&self, effective: &EffectiveDate) -> Option<&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: &LemmaSpec,
) -> (Option<DateTimeValue>, Option<DateTimeValue>)
pub fn effective_range( &self, spec: &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 effective_dates(
&self,
spec: &LemmaSpec,
context: &Context,
) -> Vec<EffectiveDate>
pub fn effective_dates( &self, spec: &LemmaSpec, context: &Context, ) -> Vec<EffectiveDate>
Global effective dates filtered to the [eff_from, eff_to) validity range of spec.
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