From ed3bfdbcfa6e532cabedcc5ef2cf33acb7a0174c Mon Sep 17 00:00:00 2001 From: Rudi Floren Date: Mon, 21 Nov 2022 10:33:15 -0800 Subject: [PATCH] add consts for common periods This allows using common periods without checking the error at runtime. --- src/domain.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/domain.rs b/src/domain.rs index ce842cb..be3cf63 100644 --- a/src/domain.rs +++ b/src/domain.rs @@ -132,6 +132,31 @@ impl Period { } } +pub const ONE_YEAR: Period = Period { + unit: 'y', + length: 1, +}; + +pub const TWO_YEARS: Period = Period { + unit: 'y', + length: 2, +}; + +pub const THREE_YEARS: Period = Period { + unit: 'y', + length: 3, +}; + +pub const ONE_MONTH: Period = Period { + unit: 'm', + length: 1, +}; + +pub const SIX_MONTHS: Period = Period { + unit: 'm', + length: 6, +}; + /// The <authInfo> tag for domain and contact transactions #[derive(Serialize, Deserialize, Debug, Clone)] pub struct DomainAuthInfo<'a> {