add consts for common periods

This allows using common periods without checking the error at runtime.
This commit is contained in:
Rudi Floren 2022-11-21 10:33:15 -08:00 committed by masalachai
parent 0f052ea125
commit ed3bfdbcfa
1 changed files with 25 additions and 0 deletions

View File

@ -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 /// The <authInfo> tag for domain and contact transactions
#[derive(Serialize, Deserialize, Debug, Clone)] #[derive(Serialize, Deserialize, Debug, Clone)]
pub struct DomainAuthInfo<'a> { pub struct DomainAuthInfo<'a> {