pub struct Recurrence {
pub rrule: String,
pub exdates: Vec<EventTime>,
pub rdates: Vec<EventTime>,
}Fields§
§rrule: StringRRULE value (after “RRULE:”), e.g. “FREQ=WEEKLY;BYDAY=MO”.
Stored as a string rather than a typed rrule::RRule for two reasons:
- Robustness — providers (especially CalDAV servers) emit RRULEs that the rrule crate can’t always parse. Typing the field would turn every such case into a load error and break sync for that event.
- Round-tripping —
rrule::RRule’s Display re-serializes from typed fields and drops redundant defaults (e.g. INTERVAL=1), causing spurious “modified” diffs on subsequent syncs.
Parse with rrule::RRule::from_str at the call site when typed access
is needed (e.g. expanding occurrences).
exdates: Vec<EventTime>§rdates: Vec<EventTime>RDATE values — explicit dates added to the recurrence set. Sometimes emited by CalDAV servers like iCloud
Note: RFC 5545 also allows PERIOD values (DTSTART/DURATION pairs)
in RDATE, but those are not modeled here — only date and date-time
values are parsed. PERIOD-valued RDATEs will be silently dropped.
Implementations§
Source§impl Recurrence
impl Recurrence
pub fn new(rrule: impl Into<String>) -> Self
Sourcepub fn truncate_before(
&self,
dtstart: &EventTime,
before: &EventTime,
) -> Recurrence
pub fn truncate_before( &self, dtstart: &EventTime, before: &EventTime, ) -> Recurrence
Return a copy truncated to end strictly before before.
The returned recurrence:
- Has any existing
UNTIL=andCOUNT=fragments stripped from its RRULE and replaced with a freshUNTIL=<just beforebefore>. - Has any EXDATEs at or after
beforeremoved (they are no longer meaningful once the series ends earlier).
dtstart is the master event’s start time; it determines the format of
the emitted UNTIL value (per RFC 5545 / the rrule crate’s matching rule).
Used to implement “split a recurring series at this instance” — a primitive that any caldir client can use to translate a “this and future” edit into two separate events on disk.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Recurrence
impl RefUnwindSafe for Recurrence
impl Send for Recurrence
impl Sync for Recurrence
impl Unpin for Recurrence
impl UnsafeUnpin for Recurrence
impl UnwindSafe for Recurrence
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.