pub enum TimeLockCadence {
None,
DayOfWeek(Weekday),
DayOfMonth(u8),
MonthOfYear(Month),
DayOfWeekInMonth(Weekday, Month),
DayOfMonthInMonth(u8, Month),
DayOfWeekAndDayOfMonth(Weekday, u8),
}Expand description
Cadence component of a scheduled time-lock — binds key derivation to a recurring calendar pattern in addition to the time-of-day constraint.
Pair with a TimeLockTime (encryption path) to express policies like:
- “only on Tuesdays at 18:00” —
DayOfWeek(Weekday::Tuesday)+ 18h - “only on the 1st at 00:00” —
DayOfMonth(1)+ 0h - “every Tuesday in February at 06:00” —
DayOfWeekInMonth(Weekday::Tuesday, Month::February)+ 6h
On the decryption side, pass pack the cadence (along with precision
and format) to obtain a TimeLockParams to store in the ciphertext
header, then call [derive_key_scheduled_now] with those params.
TimeLockCadence::None is equivalent to a plain [derive_key_at] call —
no calendar dimension is mixed into the KDF input.
§Panics
Constructing DayOfMonthInMonth is
always valid, but key derivation panics if the stored day exceeds the
month’s maximum (e.g. day 29 for February, day 31 for April).
Variants§
None
No calendar constraint — behaves like a plain time-lock.
Compact discriminant: 0.
DayOfWeek(Weekday)
Valid only on the specified weekday.
Compact discriminant: 1.
DayOfMonth(u8)
Valid only on the specified day of any month (1–31).
Days 29–31 simply never match in shorter months.
Compact discriminant: 2.
MonthOfYear(Month)
Valid only during the specified month of any year.
Compact discriminant: 3.
DayOfWeekInMonth(Weekday, Month)
Valid only on the specified weekday and during the specified month.
Compact discriminant: 4.
DayOfMonthInMonth(u8, Month)
Valid only on the specified day of the specified month.
Key derivation panics if the day exceeds the month’s maximum.
Compact discriminant: 5.
DayOfWeekAndDayOfMonth(Weekday, u8)
Valid only on the specified weekday and the specified day of month.
Days 29–31 do not match in shorter months.
Compact discriminant: 6.
Implementations§
Source§impl TimeLockCadence
impl TimeLockCadence
Sourcepub fn variant_id(self) -> u8
pub fn variant_id(self) -> u8
Returns the compact variant discriminant stored in
TimeLockParams::cadence_variant.
Trait Implementations§
Source§impl Clone for TimeLockCadence
impl Clone for TimeLockCadence
Source§fn clone(&self) -> TimeLockCadence
fn clone(&self) -> TimeLockCadence
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TimeLockCadence
impl Debug for TimeLockCadence
Source§impl PartialEq for TimeLockCadence
impl PartialEq for TimeLockCadence
impl Copy for TimeLockCadence
impl Eq for TimeLockCadence
impl StructuralPartialEq for TimeLockCadence
Auto Trait Implementations§
impl Freeze for TimeLockCadence
impl RefUnwindSafe for TimeLockCadence
impl Send for TimeLockCadence
impl Sync for TimeLockCadence
impl Unpin for TimeLockCadence
impl UnsafeUnpin for TimeLockCadence
impl UnwindSafe for TimeLockCadence
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.