ICalTimedRule

ICalTimedRule :: # (opaque)

Extracted RFC 5545 timed recurrence values, profile timed-values. UTC, floating and zoned DTSTART modes are explicit. UTC starts require Z; floating/zoned starts require local labels. UNTIL must be local for floating starts and UTC for UTC/zoned starts. Native UntilBoundary handles UTC cutoffs.

Supports SECONDLY through YEARLY with the DATE adapter's RRULE selectors. Some YEARLY combinations require explicit BYMONTH or BYDAY; see ICalDateRule. BYSECOND=60 is unsupported on the POSIX profile. RDATE/EXDATE entries are extracted values and may contain comma lists. PERIOD entries use ICalPeriod. RDATE/PERIOD values must match DTSTART's form. UTC EXDATE values are accepted for zoned DTSTART. Local exclusions match source labels; UTC exclusions match selected boundaries, including every colliding source and explicit inclusion, after COUNT and BYSETPOS. Floating/UTC mixtures remain unsupported. Zoned values assume one property TZID mapped by the caller to the supplied immutable rules. This does not parse content lines, folded ICS, property parameters or TZIDs.

Input is limited to 65536 bytes in total, 4096 entries in each input list, and 4096 expanded values per kind. Native combined inclusion capacity also applies when PERIOD values are added. Parsing constructs native definitions without enumerating occurrences or consulting rules. Source spelling and application storage envelopes are outside this profile.

definition : ICalTimedRule -> Definition

Returns the editable rule declaration, keeping source exceptions separate from PERIOD ending overrides. Use to_parts for standard interchange.

new : Definition -> Try(ICalTimedRule, Error)

Checked construction/editing for this extracted-property profile. Does not resolve zones or enumerate occurrences. Conflicting PERIOD endings remain visible and are rejected by schedule construction, never silently dropped. Validates by canonical rendering, including the exact aggregate byte cap; temporarily allocates that bounded output. Cost matches to_parts below.

to_parts : ICalTimedRule -> Try(Parts, Error)

Canonical extracted property values, capped at 65536 total UTF-8 bytes. Effective clock fields are explicit, preserving subdaily limiting fields and lower-field expansion. Cost depends only on definition size: bounded selector sorting and output bytes, never clock products or occurrences. Output retains PERIOD order and ending intent; source spelling is absent. Order is FREQ, INTERVAL, termination, calendar selectors, BYHOUR, BYMINUTE, BYSECOND, BYSETPOS, WKST. All three effective clock fields are written, including inherited values or full subdaily filter ranges.

profile : Str

Supported extracted RFC 5545 property-value profile.

parse : Parts -> Try(ICalTimedRule, Error)

Parses extracted timed recurrence values without enumerating occurrences or resolving zones. Validates mode/UNTIL compatibility and the supported profile limits.

schedule : id, ICalTimedRule, Window, Context -> Try(TimedSchedule(id), [IncompatibleContext, TooManyPeriods, TooManySelectors, InvalidDuration, EmptyWindow, ReversedWindow, OutOfRange, TooManyOverrides, ConflictingEnding(LocalDateTime)])

Explicit context for the selected mode. Floating values are bound by the application for this evaluation; no timezone is inferred. Rules remain immutable in the native cursor. Start/end selection follows RFC first-fold and before-gap policies, and all native schedule budgets remain available.

prepare : ICalTimedRule, Context -> Try({ rule : TimedRecurrence, endings : Endings, context : Context }, [IncompatibleContext, TooManyPeriods, TooManySelectors, InvalidDuration, OutOfRange, TooManyOverrides, ConflictingEnding(LocalDateTime)])

Advanced context validation and checked ending preparation, without occurrence enumeration. Reuse with TimedSchedule.from_prepared; ordinary callers can use ScheduleDefinition to retain the original declaration too.

fact_count : ICalTimedRule -> U64

Counts facts describing the mode, duration, PERIOD additions and effective recurrence selectors. These facts do not retain original RRULE spelling.

fact_at : ICalTimedRule, U64 -> [End, Item(SemanticFact)]

Returns the zero-based semantic fact, or End when the index is outside fact_count. Facts describe meaning, not a serialized record.

to_inspect : ICalTimedRule -> Str

A concise semantic summary for debugging. Use the standard text encoder for storage or interchange.

Mode : [Utc, Floating, Zoned]

Utc uses Z values; Floating uses local labels interpreted by the caller; Zoned uses local labels under one explicitly supplied zone.

Parts : { start : Str, rule : Str, duration : Str, inclusions : List(Str), exclusions : List(Str), periods : List(Str), mode : Mode }

Extracted DTSTART, RRULE, duration, RDATE, EXDATE and PERIOD text plus interpretation mode. Supply values rather than ICS content lines.

Error : [TooLarge, OutOfRange(Str), PrecisionLoss(Str), DateTime(Str, Error), Duration(Error), Period(Error), Rule(Error), Incompatible(Str), Unsupported(Str), InvalidRule([InvalidInterval, TooManySelectors, InvalidSelector(Str), InvalidCombination(Str), OutOfRange, InvalidHour, InvalidMinute, InvalidSecond, UnsupportedLeapSecond, InvalidCount, InvalidUntil, InvalidSetPosition, UnsynchronizedStart])]

Reports property-level syntax, unsupported combinations, precision/range/size limits and native recurrence validation failures.

Definition : { rule : TimedRecurrence, duration : ICalDuration, periods : List(ICalPeriod), mode : Mode }

Editable semantic rule, default duration, ordered PERIOD additions and mode. Pass edits through new to check profile compatibility.