pub struct LemmaSpecSet {
pub name: String,
/* private fields */
}Expand description
All specs sharing a name, keyed by effective_from.
Fields§
§name: StringImplementations§
Source§impl LemmaSpecSet
impl LemmaSpecSet
pub fn new(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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for LemmaSpecSet
impl RefUnwindSafe for LemmaSpecSet
impl Send for LemmaSpecSet
impl Sync for LemmaSpecSet
impl Unpin for LemmaSpecSet
impl UnsafeUnpin for LemmaSpecSet
impl UnwindSafe for LemmaSpecSet
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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