pub struct TemporalVersion {
pub version_id: String,
pub issued_date: Option<NaiveDate>,
pub early_adoption_from: Option<NaiveDate>,
pub effective_from: NaiveDate,
pub superseded_at: Option<NaiveDate>,
pub jurisdiction_overrides: HashMap<String, NaiveDate>,
pub change_summary: Vec<String>,
pub impact: ChangeImpact,
}Expand description
A specific version of a standard with temporal bounds.
Fields§
§version_id: StringVersion identifier (e.g., “2018”, “2020-amended”, “2023-revised”)
issued_date: Option<NaiveDate>Date this version was issued/published
early_adoption_from: Option<NaiveDate>Date this version becomes available for early adoption
effective_from: NaiveDateDate this version becomes mandatory (global default)
superseded_at: Option<NaiveDate>Date this version is superseded (None = currently active)
jurisdiction_overrides: HashMap<String, NaiveDate>Per-jurisdiction effective date overrides
change_summary: Vec<String>Key changes from the previous version
impact: ChangeImpactImpact level on generated data
Implementations§
Source§impl TemporalVersion
impl TemporalVersion
Sourcepub fn new(
version_id: impl Into<String>,
effective_from: NaiveDate,
impact: ChangeImpact,
) -> Self
pub fn new( version_id: impl Into<String>, effective_from: NaiveDate, impact: ChangeImpact, ) -> Self
Creates a new temporal version with required fields.
Sourcepub fn with_issued_date(self, date: NaiveDate) -> Self
pub fn with_issued_date(self, date: NaiveDate) -> Self
Sets the issued date.
Sourcepub fn with_early_adoption(self, date: NaiveDate) -> Self
pub fn with_early_adoption(self, date: NaiveDate) -> Self
Sets the early adoption date.
Sourcepub fn superseded_at(self, date: NaiveDate) -> Self
pub fn superseded_at(self, date: NaiveDate) -> Self
Sets the superseded date.
Sourcepub fn with_jurisdiction_override(self, country: &str, date: NaiveDate) -> Self
pub fn with_jurisdiction_override(self, country: &str, date: NaiveDate) -> Self
Adds a jurisdiction-specific effective date override.
Sourcepub fn with_change(self, summary: impl Into<String>) -> Self
pub fn with_change(self, summary: impl Into<String>) -> Self
Adds a change summary item.
Sourcepub fn is_active_at(&self, date: NaiveDate) -> bool
pub fn is_active_at(&self, date: NaiveDate) -> bool
Returns whether this version is active at a given date (global, ignoring jurisdiction overrides).
Sourcepub fn is_active_at_in(&self, date: NaiveDate, country: &str) -> bool
pub fn is_active_at_in(&self, date: NaiveDate, country: &str) -> bool
Returns whether this version is active at a given date for a specific jurisdiction.
Sourcepub fn effective_date_for(&self, country: &str) -> NaiveDate
pub fn effective_date_for(&self, country: &str) -> NaiveDate
Returns the effective date for a specific jurisdiction.
Sourcepub fn days_active_at(&self, date: NaiveDate) -> Option<i64>
pub fn days_active_at(&self, date: NaiveDate) -> Option<i64>
Returns the number of days this version has been active as of a given date.
Trait Implementations§
Source§impl Clone for TemporalVersion
impl Clone for TemporalVersion
Source§fn clone(&self) -> TemporalVersion
fn clone(&self) -> TemporalVersion
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TemporalVersion
impl Debug for TemporalVersion
Source§impl<'de> Deserialize<'de> for TemporalVersion
impl<'de> Deserialize<'de> for TemporalVersion
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for TemporalVersion
impl RefUnwindSafe for TemporalVersion
impl Send for TemporalVersion
impl Sync for TemporalVersion
impl Unpin for TemporalVersion
impl UnsafeUnpin for TemporalVersion
impl UnwindSafe for TemporalVersion
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.