automata
Compute state transitions, schedules, filesystem differences, calendar documents, and retry decisions.
All operations are pure and run on Erlang and JavaScript. Your application supplies dates and filesystem observations, executes scheduled work, and waits between retries.
Choosing an operation
| Area | Start here |
|---|---|
| Finite state machines | Automaton, run, accepts |
| Cron | cron_parse_raw, cron_validate, cron_new |
| Recurrence rules | rrule_parse_raw, rrule_validate, rrule_new |
| Occurrences | schedule_from_cron, schedule_from_rrule, schedule_every, schedule_next |
| Events | Event, builtin_event, event_continue_from |
| Filesystem changes | path_normalize, snapshot_from_entries, diff_snapshots |
| iCalendar | ical_parse, ical_new_calendar, ical_encode |
| Retries | retry_fixed, retry_exponential, retry_start, retry_decide |
Civil dates and schedules
DateTime uses Date and TimeOfDay from gleam_time’s calendar module. Validate a real Gregorian date and zero nanoseconds with datetime_validate. These civil values carry no timezone; a TZID in an iCalendar document does not change schedule arithmetic.
Build a reusable Schedule from validated cron or recurrence input. A recurring rule keeps its original anchor and total COUNT when a query starts later. Use schedule_iterator for an inclusive or exclusive boundary and schedule_step for each occurrence. Done and Ok(None) describe established endings. Work-limit and numeric-range failures remain errors, so callers can distinguish a finished sequence from an incomplete search.
iCalendar values and forms
The calendar model covers VEVENT, VTODO, VJOURNAL, VFREEBUSY, VTIMEZONE, VALARM, and unknown nested components. Parsed values retain supported parameters and DATE, floating, UTC, or TZID forms. Scalar updates reset their property’s preserved form, including when the value is unchanged; repeated-value additions preserve earlier values and forms. Getters return stored values in order.
Constructors and updates do not perform complete RFC validation. ical_encode checks typed dates, wire years, and raw physical newlines, then escapes TEXT and folds UTF-8 lines. It normalizes typed TEXT line endings during encoding; it does not change values returned by getters. Components are emitted in groups while preserving order within each kind.
Retry decisions
Retry policies use gleam_time Duration values with nonnegative whole-millisecond precision. The attempt limit includes the initial attempt. A context’s seed makes jitter reproducible. retry_decide returns a delay and next context or a reason to give up; the application performs the wait and the next attempt.
Types
A deterministic state machine with caller-supplied transition and acceptance functions.
The state and input symbol may be any types. run folds inputs from the initial state; accepts tests the resulting state.
pub type Automaton(state, symbol) {
Automaton(
initial_state: state,
transition: fn(state, symbol) -> state,
accepting: fn(state) -> Bool,
)
}
Constructors
-
Automaton( initial_state: state, transition: fn(state, symbol) -> state, accepting: fn(state) -> Bool, )
Whether an occurrence exactly at the supplied civil time is included in a query.
pub type Boundary {
Inclusive(ValidDateTime)
Exclusive(ValidDateTime)
}
Constructors
-
Inclusive(ValidDateTime) -
Exclusive(ValidDateTime)
A validated cron specification. Create it with cron_validate or cron_new.
pub opaque type Cron
The expression or cron field associated with a parse or validation error.
pub type CronField {
CronExpression
CronMinute
CronHour
CronDayOfMonth
CronMonth
CronDayOfWeek
}
Constructors
-
CronExpression -
CronMinute -
CronHour -
CronDayOfMonth -
CronMonth -
CronDayOfWeek
An exact value, inclusive range, or stepped selection within a cron field.
Validate these values through cron_new; constructing an item does not check its range or step.
pub type CronItem {
CronExact(Int)
CronRange(Int, Int)
CronStep(CronStepBase, Int)
}
Constructors
-
CronExact(Int) -
CronRange(Int, Int) -
CronStep(CronStepBase, Int)
Unvalidated cron selectors that can be changed with record updates.
Start with cron_options for all-wildcard fields, then validate using cron_new.
pub type CronOptions {
CronOptions(
minute: CronSelector,
hour: CronSelector,
day_of_month: CronSelector,
month: CronSelector,
day_of_week: CronSelector,
)
}
Constructors
-
CronOptions( minute: CronSelector, hour: CronSelector, day_of_month: CronSelector, month: CronSelector, day_of_week: CronSelector, )
An expression-level syntax error found before cron field validation.
pub type CronParseError {
CronParseInvalidExpression(value: String)
CronParseInvalidFieldCount(expected: Int, actual: Int)
CronParseUnsupportedSyntax(field: CronField, value: String)
CronParseRebootNotSupported(value: String)
}
Constructors
-
CronParseInvalidExpression(value: String) -
CronParseInvalidFieldCount(expected: Int, actual: Int) -
CronParseUnsupportedSyntax(field: CronField, value: String) -
CronParseRebootNotSupported(value: String)
An unvalidated field selector: wildcard or a nonempty list of items.
cron_new checks the selector against its field’s range. A wildcard retains its day-matching meaning even when an explicit value list covers the same range.
pub type CronSelector {
CronAny
CronValues(List(CronItem))
}
Constructors
-
CronAny -
CronValues(List(CronItem))
The full field range, a starting value, or an inclusive range to which a step applies.
pub type CronStepBase {
CronStepAny
CronStepExact(Int)
CronStepRange(Int, Int)
}
Constructors
-
CronStepAny -
CronStepExact(Int) -
CronStepRange(Int, Int)
An invalid cron field value, unsupported field syntax, or impossible date selection.
pub type CronValidationError {
CronUnsupportedSyntax(field: CronField, value: String)
CronInvalidNumber(field: CronField, value: String)
CronInvalidAlias(field: CronField, value: String)
CronInvalidRange(field: CronField, value: String)
CronInvalidStep(field: CronField, value: String)
CronInvalidList(field: CronField, value: String)
CronOutOfRange(
field: CronField,
min: Int,
max: Int,
actual: Int,
)
CronImpossibleDate(day_of_month: String, month: String)
}
Constructors
-
CronUnsupportedSyntax(field: CronField, value: String) -
CronInvalidNumber(field: CronField, value: String) -
CronInvalidAlias(field: CronField, value: String) -
CronInvalidRange(field: CronField, value: String) -
CronInvalidStep(field: CronField, value: String) -
CronInvalidList(field: CronField, value: String) -
CronOutOfRange(field: CronField, min: Int, max: Int, actual: Int) -
CronImpossibleDate(day_of_month: String, month: String)
A civil Gregorian date and time using the core gleam_time types.
This record may contain invalid values or fractional seconds. datetime_validate checks it for whole-second scheduling. It carries no timezone or UTC offset.
pub type DateTime {
DateTime(date: calendar.Date, time: calendar.TimeOfDay)
}
Constructors
-
DateTime(date: calendar.Date, time: calendar.TimeOfDay)
An out-of-range JavaScript year, invalid Gregorian date, or invalid whole-second time.
pub type DateTimeError {
InvalidDate(year: Int, month: Int, day: Int)
InvalidTime(
hour: Int,
minute: Int,
second: Int,
nanoseconds: Int,
)
DateTimeYearOutOfRange(year: Int)
}
Constructors
-
InvalidDate(year: Int, month: Int, day: Int) -
InvalidTime( hour: Int, minute: Int, second: Int, nanoseconds: Int, ) -
DateTimeYearOutOfRange(year: Int)
A validated filesystem observation supplied by the caller.
Size and modification time are nonnegative safe integers on both targets. Optional hash and identity strings are nonempty when present; mode is stored as supplied. The caller chooses consistent modification-time units.
pub opaque type Entry
The observed entry kind: file, directory, or symbolic link.
pub type EntryKind {
File
Directory
Symlink
}
Constructors
-
File -
Directory -
Symlink
An event with an arbitrary body, producer, civil occurrence time, and metadata.
This is an ordinary record. The caller chooses its source/body combination; builtin_event derives the source kind for the built-in body variants.
pub type Event(body) {
Event(
id: String,
occurred_at: ValidDateTime,
source: Source,
body: body,
metadata: Metadata,
)
}
Constructors
-
Event( id: String, occurred_at: ValidDateTime, source: Source, body: body, metadata: Metadata, )
Built-in scheduled, filesystem, manual, and custom event bodies. Generic Event records can use other body types.
pub type EventBody {
Scheduled(
plan_id: String,
fired_at: ValidDateTime,
schedule_kind: ScheduleKind,
)
FileSystem(event: WatchEvent)
Manual(
reason: option.Option(String),
actor: option.Option(String),
)
Custom(kind: String, attributes: dict.Dict(String, String))
}
Constructors
-
Scheduled( plan_id: String, fired_at: ValidDateTime, schedule_kind: ScheduleKind, ) -
FileSystem(event: WatchEvent) -
Manual( reason: option.Option(String), actor: option.Option(String), ) -
Custom(kind: String, attributes: dict.Dict(String, String))
Whether the failed operation may be retried. Permanent failures stop before policy and attempt-limit checks.
pub type FailureKind {
Transient
Permanent
}
Constructors
-
Transient -
Permanent
An invalid path, entry value, duplicate snapshot path, or inconsistent event operation set.
pub type FilesystemError {
EmptyPath
PathContainsDotSegment(path: String, segment: String)
PathContainsNullByte(path: String)
UncPathNotSupported(path: String)
DuplicatePath(path: String)
NegativeEntryField(field: String, actual: Int)
EntryFieldOverflow(field: String, actual: Int)
EmptyOptionalField(field: String)
EmptyOps
RenamedFromWithoutRenameOp(path: String)
}
Constructors
-
EmptyPath -
PathContainsDotSegment(path: String, segment: String) -
PathContainsNullByte(path: String) -
UncPathNotSupported(path: String) -
DuplicatePath(path: String) -
NegativeEntryField(field: String, actual: Int) -
EntryFieldOverflow(field: String, actual: Int) -
EmptyOptionalField(field: String) -
EmptyOps -
RenamedFromWithoutRenameOp(path: String)
The recurrence period, from seconds through years.
pub type Frequency {
Secondly
Minutely
Hourly
Daily
Weekly
Monthly
Yearly
}
Constructors
-
Secondly -
Minutely -
Hourly -
Daily -
Weekly -
Monthly -
Yearly
Why a retry decision stops: policy, total attempt limit, permanent failure, or delay overflow.
pub type GiveUpReason {
PolicyDisallowsRetry
MaxAttemptsReached(attempts: Int, limit: Int)
PermanentFailureSignaled(at_attempt: Int)
DelayOverflow(at_attempt: Int)
}
Constructors
-
PolicyDisallowsRetry -
MaxAttemptsReached(attempts: Int, limit: Int) -
PermanentFailureSignaled(at_attempt: Int) -
DelayOverflow(at_attempt: Int)
A VALARM with string-valued action and trigger, optional fields, attendees, and preserved forms.
pub opaque type IcalAlarm
Calendar components and properties with their preserved wire forms.
The opaque representation keeps values and forms aligned. It does not guarantee complete RFC validity; construction stores supplied values and ical_encode checks supported wire constraints.
pub opaque type IcalCalendar
A typed date, year representation, or physical-newline error during encoding.
Errors follow logical emission order. Date validation precedes wire-year validation for a date field; a completed logical line is then checked for raw CR or LF.
pub type IcalEncodeError {
IcalInvalidDateValue(
property: String,
value: DateTime,
error: DateTimeError,
)
IcalYearNotRepresentable(property: String, year: Int)
IcalPhysicalNewline(logical_line: String)
}
Constructors
-
IcalInvalidDateValue( property: String, value: DateTime, error: DateTimeError, ) -
IcalYearNotRepresentable(property: String, year: Int) -
IcalPhysicalNewline(logical_line: String)
An iCalendar lexical, structural, or supported typed-value error. Nested RRULE syntax errors retain their original details.
pub type IcalError {
IcalUnexpectedEnd(line: Int)
IcalMismatchedBlock(begin: String, end: String, line: Int)
IcalMalformedProperty(line: Int, raw: String)
IcalMalformedParameter(line: Int, raw: String)
IcalMissingVersion
IcalMissingProductId
IcalMissingComponentProperty(component: String, name: String)
IcalInvalidDateTime(name: String, raw: String)
IcalInvalidEscape(raw: String)
IcalInvalidInteger(name: String, raw: String)
IcalInvalidRRule(raw: String, error: RruleParseError)
IcalDuplicateRRule(component_uid: String)
IcalEmptyInputError
}
Constructors
-
IcalUnexpectedEnd(line: Int) -
IcalMismatchedBlock(begin: String, end: String, line: Int) -
IcalMalformedProperty(line: Int, raw: String) -
IcalMalformedParameter(line: Int, raw: String) -
IcalMissingVersion -
IcalMissingProductId -
IcalMissingComponentProperty(component: String, name: String) -
IcalInvalidDateTime(name: String, raw: String) -
IcalInvalidEscape(raw: String) -
IcalInvalidInteger(name: String, raw: String) -
IcalInvalidRRule(raw: String, error: RruleParseError) -
IcalDuplicateRRule(component_uid: String) -
IcalEmptyInputError
A VEVENT with typed fields and preserved parameters, date forms, repeated values, and alarms.
pub opaque type IcalEvent
A VFREEBUSY with typed date fields, attendees, string-valued periods, and preserved forms.
pub opaque type IcalFreeBusy
A VJOURNAL with typed fields, categories, extension properties, and preserved forms.
pub opaque type IcalJournal
An iCalendar property parameter name and value.
pub type IcalParameter {
IcalParameter(name: String, value: String)
}
Constructors
-
IcalParameter(name: String, value: String)
The raw top-level calendar properties and component tree returned by ical_parse_raw.
pub type IcalRawCalendar {
IcalRawCalendar(
properties: List(IcalRawProperty),
components: List(IcalRawComponent),
)
}
Constructors
-
IcalRawCalendar( properties: List(IcalRawProperty), components: List(IcalRawComponent), )
A raw component with its kind, properties, child components, and opening line position.
pub type IcalRawComponent {
IcalRawComponent(
kind: String,
properties: List(IcalRawProperty),
children: List(IcalRawComponent),
begin_line: Int,
)
}
Constructors
-
IcalRawComponent( kind: String, properties: List(IcalRawProperty), children: List(IcalRawComponent), begin_line: Int, )
A property name, ordered parameters, raw value, and source line position before typed interpretation.
pub type IcalRawProperty {
IcalRawProperty(
name: String,
parameters: List(IcalParameter),
raw_value: String,
line: Int,
)
}
Constructors
-
IcalRawProperty( name: String, parameters: List(IcalParameter), raw_value: String, line: Int, )
A VTIMEZONE with STANDARD and DAYLIGHT rules and their preserved forms. It does not perform timezone conversion.
pub opaque type IcalTimezone
A STANDARD or DAYLIGHT rule for a timezone component.
Use record construction and updates. DTSTART is a civil value; offsets and recurrence syntax are stored without executing a timezone calculation.
pub type IcalTimezoneRule {
IcalTimezoneRule(
dtstart: DateTime,
tzoffsetfrom: String,
tzoffsetto: String,
rrule: option.Option(RawRRule),
tzname: option.Option(String),
)
}
Constructors
-
IcalTimezoneRule( dtstart: DateTime, tzoffsetfrom: String, tzoffsetto: String, rrule: option.Option(RawRRule), tzname: option.Option(String), )
A VTODO task with typed fields, preserved property forms, recurrence dates, and alarms.
pub opaque type IcalTodo
An unrecognized component whose raw properties and nested components are preserved.
pub type IcalUnknownComponent {
IcalUnknownComponent(
kind: String,
properties: List(IcalRawProperty),
children: List(IcalRawComponent),
)
}
Constructors
-
IcalUnknownComponent( kind: String, properties: List(IcalRawProperty), children: List(IcalRawComponent), )
An occurrence with its continuation, or the established end of a sequence. Search failures are returned separately as errors.
pub type IterStep {
Yield(at: ValidDateTime, next: OccurrenceIterator)
Done
}
Constructors
-
Yield(at: ValidDateTime, next: OccurrenceIterator) -
Done
How a retry policy varies its base delay in integer milliseconds using the context seed.
pub type Jitter {
NoJitter
FullJitter
EqualJitter
}
Constructors
-
NoJitter -
FullJitter -
EqualJitter
Optional correlation, causation, and trace identifiers, plus caller-defined string attributes.
pub type Metadata {
Metadata(
correlation_id: option.Option(String),
causation_id: option.Option(String),
trace_id: option.Option(String),
attributes: dict.Dict(String, String),
)
}
Constructors
-
Metadata( correlation_id: option.Option(String), causation_id: option.Option(String), trace_id: option.Option(String), attributes: dict.Dict(String, String), )
A validated portable path with normalized separators and complete segments.
Construct it with path_normalize. Normalization is purely textual and does not resolve the filesystem.
pub opaque type NormalizedPath
An immutable schedule position with its original anchor and consumed occurrence count.
Stepping returns a new position without changing the old one. This value owns no process, clock, or external resource.
pub opaque type OccurrenceIterator
A filesystem create, content write, removal, rename, or mode change.
pub type Op {
Create
Write
Remove
Rename
Chmod
}
Constructors
-
Create -
Write -
Remove -
Rename -
Chmod
Unvalidated text for the five UNIX cron fields, in minute-to-weekday order.
pub type RawCron {
RawCron(
minute: String,
hour: String,
day_of_month: String,
month: String,
day_of_week: String,
)
}
Constructors
-
RawCron( minute: String, hour: String, day_of_month: String, month: String, day_of_week: String, )
Ordered, unvalidated RRULE name/value parts. Duplicate names are still representable.
pub type RawRRule {
RawRRule(parts: List(RawRulePart))
}
Constructors
-
RawRRule(parts: List(RawRulePart))
One RRULE name and its unvalidated text value.
pub type RawRulePart {
RawRulePart(name: String, value: String)
}
Constructors
-
RawRulePart(name: String, value: String)
Unvalidated recurrence settings for record updates.
None means a BY filter was omitted; Some([]) is invalid. rrule_options supplies interval one and no end or filters. Validate the updated record with rrule_new.
pub type RecurrenceOptions {
RecurrenceOptions(
frequency: Frequency,
interval: Int,
end_condition: EndCondition,
by_day: option.Option(List(WeekdaySpecifier)),
by_month: option.Option(List(Int)),
by_month_day: option.Option(List(Int)),
by_hour: option.Option(List(Int)),
by_minute: option.Option(List(Int)),
)
}
Constructors
-
RecurrenceOptions( frequency: Frequency, interval: Int, end_condition: EndCondition, by_day: option.Option(List(WeekdaySpecifier)), by_month: option.Option(List(Int)), by_month_day: option.Option(List(Int)), by_hour: option.Option(List(Int)), by_minute: option.Option(List(Int)), )
A validated recurrence specification without an anchor. Anchor it using schedule_from_rrule.
pub opaque type RecurrenceRule
An immutable retry state containing its policy, attempt number, random state, and cumulative selected delay.
pub opaque type RetryContext
A delay and context for another attempt, or a reason to give up. The caller performs the wait and operation.
pub type RetryDecision {
Retry(delay: duration.Duration, next: RetryContext)
GiveUp(reason: GiveUpReason)
}
Constructors
-
Retry(delay: duration.Duration, next: RetryContext) -
GiveUp(reason: GiveUpReason)
An invalid retry duration or policy parameter.
Duration admission checks negative seconds first, fractional milliseconds second, and the supported maximum last. Duration errors preserve the normalized seconds/nanoseconds pair. Policy constructors document their argument-check order.
pub type RetryError {
NegativeDuration(seconds: Int, nanoseconds: Int)
FractionalMilliseconds(seconds: Int, nanoseconds: Int)
DurationOverflow(seconds: Int, nanoseconds: Int)
MaxAttemptsMustBePositive(actual: Int)
MultiplierMustBeAtLeastTwo(actual: Int)
InitialDelayMustBePositive(actual_milliseconds: Int)
CapMustNotBeLessThanInitial(
cap_milliseconds: Int,
initial_milliseconds: Int,
)
}
Constructors
-
NegativeDuration(seconds: Int, nanoseconds: Int) -
FractionalMilliseconds(seconds: Int, nanoseconds: Int) -
DurationOverflow(seconds: Int, nanoseconds: Int) -
MaxAttemptsMustBePositive(actual: Int) -
MultiplierMustBeAtLeastTwo(actual: Int) -
InitialDelayMustBePositive(actual_milliseconds: Int) -
CapMustNotBeLessThanInitial( cap_milliseconds: Int, initial_milliseconds: Int, )
A validated retry strategy with an optional jitter mode.
Durations are nonnegative whole milliseconds bounded by 9,007,199,254,740,991 milliseconds. Attempt limits count the initial attempt as well as retries.
pub opaque type RetryPolicy
A syntax error in RRULE parts, before semantic validation.
pub type RruleParseError {
RruleParseInvalidRule(value: String)
RruleParseInvalidPartSyntax(value: String)
RruleParseEmptyPart(value: String)
}
Constructors
-
RruleParseInvalidRule(value: String) -
RruleParseInvalidPartSyntax(value: String) -
RruleParseEmptyPart(value: String)
An invalid or unsupported recurrence value, combination, or target integer range.
pub type RruleValidationError {
RruleMissingPart(part: RulePart)
RruleDuplicatePart(part: RulePart)
RruleUnknownPart(name: String)
RruleUnsupportedPart(name: String)
RruleInvalidNumber(part: RulePart, value: String)
RruleInvalidPartValue(part: RulePart, value: String)
RruleInvalidList(part: RulePart, value: String)
RruleOutOfRange(
part: RulePart,
min: Int,
max: Int,
actual: Int,
)
RruleMustBePositive(part: RulePart, actual: Int)
RruleMutuallyExclusiveParts(left: RulePart, right: RulePart)
RruleNumericWeekdayRequiresMonthlyOrYearly(
frequency: Frequency,
)
RruleImpossibleDate(by_month: String, by_month_day: String)
RruleIncompatibleFrequencyAndPart(
frequency: Frequency,
part: RulePart,
)
RruleUntilMissingZ(value: String)
RruleUntilMalformedDateTime(value: String)
RruleIntegerOutOfRange(part: RulePart, actual: Int)
}
Constructors
-
RruleMissingPart(part: RulePart) -
RruleDuplicatePart(part: RulePart) -
RruleUnknownPart(name: String) -
RruleUnsupportedPart(name: String) -
RruleInvalidNumber(part: RulePart, value: String) -
RruleInvalidPartValue(part: RulePart, value: String) -
RruleInvalidList(part: RulePart, value: String) -
RruleOutOfRange(part: RulePart, min: Int, max: Int, actual: Int) -
RruleMustBePositive(part: RulePart, actual: Int) -
-
RruleNumericWeekdayRequiresMonthlyOrYearly(frequency: Frequency) -
RruleImpossibleDate(by_month: String, by_month_day: String) -
-
RruleUntilMissingZ(value: String) -
RruleUntilMalformedDateTime(value: String) -
RruleIntegerOutOfRange(part: RulePart, actual: Int)
The recurrence field associated with a validation error.
pub type RulePart {
FreqPart
IntervalPart
CountPart
UntilPart
ByDayPart
ByMonthPart
ByMonthDayPart
ByHourPart
ByMinutePart
}
Constructors
-
FreqPart -
IntervalPart -
CountPart -
UntilPart -
ByDayPart -
ByMonthPart -
ByMonthDayPart -
ByHourPart -
ByMinutePart
A reusable cron, recurrence, fixed-interval, or one-shot schedule with validated inputs and private lookup data.
pub opaque type Schedule
An invalid fixed interval or a failure to compute a schedule result.
ScheduleSearchLimitReached reports a candidate-work limit, not the end of a sequence. ScheduleNumericOverflow means a necessary value exceeds the target’s exact integer range. Callers should retain these distinctions from a successful empty result.
pub type ScheduleError {
EveryIntervalMustBePositive(actual: Int)
ScheduleSearchLimitReached(limit: Int)
ScheduleNumericOverflow
}
Constructors
-
EveryIntervalMustBePositive(actual: Int) -
ScheduleSearchLimitReached(limit: Int) -
ScheduleNumericOverflow
Whether a built-in scheduled event identifies a cron or RRULE schedule.
pub type ScheduleKind {
CronSchedule
RRuleSchedule
}
Constructors
-
CronSchedule -
RRuleSchedule
A collection with one entry per normalized path. Duplicate paths are rejected on construction or insertion.
pub opaque type Snapshot
An event producer’s kind, identifier, and optional display name.
pub type Source {
Source(
kind: SourceKind,
id: String,
name: option.Option(String),
)
}
Constructors
-
Source(kind: SourceKind, id: String, name: option.Option(String))
An event producer classification, including a caller-named custom source.
pub type SourceKind {
ScheduleSource
FileSystemSource
ManualSource
WebhookSource
QueueSource
SignalSource
HttpSource
CloudEventSource
CustomSource(String)
}
Constructors
-
ScheduleSource -
FileSystemSource -
ManualSource -
WebhookSource -
QueueSource -
SignalSource -
HttpSource -
CloudEventSource -
CustomSource(String)
An inclusive recurrence end date or whole-second end time.
A date includes its entire day. The supported UNTIL year range is 0 through 9999; a DateTime end must have zero nanoseconds.
pub type Until {
UntilDate(calendar.Date)
UntilDateTime(DateTime)
}
Constructors
-
UntilDate(calendar.Date) -
UntilDateTime(DateTime)
A real Gregorian date and valid time with zero nanoseconds.
Year zero and negative years are supported. JavaScript years must be safe integers; Erlang years retain arbitrary precision. Construct a value with datetime_validate.
pub opaque type ValidDateTime
A filesystem event with a nonempty operation set.
An old path can be present only when Rename is included. Rename itself may omit the old path.
pub opaque type WatchEvent
A weekday filter, optionally with a positive or negative ordinal.
Ordinal zero is invalid. Numbered weekdays require a monthly or yearly rule; other range and combination checks occur in rrule_new or rrule_validate.
pub type WeekdaySpecifier {
EveryWeekday(calendar.DayOfWeek)
NthWeekday(Int, calendar.DayOfWeek)
}
Constructors
-
EveryWeekday(calendar.DayOfWeek) -
NthWeekday(Int, calendar.DayOfWeek)
Values
pub fn accepts(
automaton: Automaton(state, symbol),
inputs: List(symbol),
) -> Bool
Run the input sequence and test its final state with the accepting predicate.
An empty sequence tests the initial state.
pub fn builtin_event(
id id: String,
occurred_at occurred_at: ValidDateTime,
source_id source_id: String,
body body: EventBody,
) -> Event(EventBody)
Create an event whose source classification is derived from its built-in body.
Use the supplied source id with no display name and empty metadata. Ordinary Event records also support arbitrary body types; constructing those records directly does not validate source/body agreement.
pub fn cron_new(
options: CronOptions,
) -> Result(Cron, CronValidationError)
Validate typed cron options.
Reject empty value lists, nonpositive steps, invalid ranges, and out-of-range values. Check fields in minute, hour, day-of-month, month, day-of-week order, then date constraints. The resulting specification can be passed to schedule_from_cron.
Examples
let options = cron_options()
let assert Ok(cron) = cron_new(CronOptions(
..options, minute: CronValues([CronExact(15)]),
))
cron_to_string(cron)
// "15 * * * *"
cron_new(CronOptions(..options, minute: CronValues([CronExact(90)])))
// Error(CronOutOfRange(CronMinute, 0, 59, 90))
pub fn cron_options() -> CronOptions
Return cron options with all five fields set to CronAny.
Use record updates to select fields, then call cron_new to validate them.
pub fn cron_parse_raw(
input input: String,
) -> Result(RawCron, CronParseError)
Parse a five-field UNIX cron expression into unvalidated field text.
Fields are minute, hour, day of month, month, and day of week. This stage checks expression syntax; call cron_validate to check ranges, aliases, steps, and date constraints.
pub fn cron_to_options(cron: Cron) -> CronOptions
Return the validated selectors as ordinary cron options.
Updating these options does not change the original specification. Pass the updated record through cron_new.
pub fn cron_to_string(spec spec: Cron) -> String
Render the specification as a canonical five-field cron expression.
pub fn cron_validate(
raw raw: RawCron,
) -> Result(Cron, CronValidationError)
Validate raw cron fields and produce a reusable cron specification.
Check minute, hour, day of month, month, and day of week in that order, then date constraints. Sunday accepts 0 or 7. When both day fields are restricted, a match in either field is sufficient. Preserve the distinction between a wildcard and an explicitly listed full range.
pub fn datetime_to_string(value: ValidDateTime) -> String
Format a validated civil value as YYYY-MM-DDTHH:MM:SS.
Use at least four year digits, with a leading minus for negative years and all digits for larger years. Append no timezone suffix.
pub fn datetime_validate(
value: DateTime,
) -> Result(ValidDateTime, DateTimeError)
Validate a civil date and whole-second time.
Check JavaScript’s safe integer year range first, then the Gregorian date, then the time with nanoseconds equal to zero. Year zero and negative years are supported. Erlang retains arbitrary-precision years. The value has no timezone or daylight-saving interpretation.
Examples
import gleam/time/calendar
let date = calendar.Date(2026, calendar.January, 1)
datetime_validate(DateTime(date, calendar.TimeOfDay(12, 0, 0, 1)))
// Error(InvalidTime(12, 0, 0, 1))
let assert Ok(at) = datetime_validate(DateTime(
date, calendar.TimeOfDay(12, 0, 0, 0),
))
datetime_to_string(at)
// "2026-01-01T12:00:00"
pub fn datetime_value(value: ValidDateTime) -> DateTime
Read the civil date and time held by a validated value.
pub fn diff_snapshots(
previous: Snapshot,
current: Snapshot,
observing observing: set.Set(Op),
) -> List(WatchEvent)
Compare two supplied snapshots and retain only observed operations.
Detect create, write, remove, rename, and mode changes. For file content, compare hashes when both are available; otherwise compare size and mtime. Match unique file identities for renames, including identities whose entry kind changes; ambiguous identities are not treated as a rename.
Intersect each event’s operations with observing and drop empty events. If Rename is removed by this filter, also remove its old path. Pass all_ops() to observe every operation. This function reads no files and starts no watcher.
pub fn entry_content_hash(
entry entry: Entry,
) -> option.Option(String)
Read the optional content hash. Directory and symbolic-link entries have none.
pub fn entry_directory(
path path: NormalizedPath,
mtime mtime: Int,
mode mode: Int,
file_id file_id: option.Option(String),
) -> Result(Entry, FilesystemError)
Validate a directory observation, storing size zero and no content hash.
Require mtime within the nonnegative safe integer range and a nonempty file_id when supplied. Mode is stored as supplied.
pub fn entry_file(
path path: NormalizedPath,
size size: Int,
mtime mtime: Int,
mode mode: Int,
content_hash content_hash: option.Option(String),
file_id file_id: option.Option(String),
) -> Result(Entry, FilesystemError)
Validate a file observation for a snapshot.
Check size, then mtime, within 0 through 9,007,199,254,740,991. If supplied, content_hash and file_id must be nonempty, checked in that order. Mode is stored as supplied. Choose one mtime unit and use it consistently across compared snapshots; only equality is tested.
pub fn entry_file_id(entry entry: Entry) -> option.Option(String)
Read the optional identity used to detect moves between paths.
pub fn entry_kind(entry entry: Entry) -> EntryKind
Read whether the entry is a file, directory, or symbolic link.
pub fn entry_mtime(entry entry: Entry) -> Int
Read the modification-time value in the unit supplied by the caller.
pub fn entry_path(entry entry: Entry) -> NormalizedPath
Read the entry’s normalized path.
pub fn entry_size(entry entry: Entry) -> Int
Read the file size; directory and symbolic-link entries return zero.
pub fn entry_symlink(
path path: NormalizedPath,
mtime mtime: Int,
mode mode: Int,
file_id file_id: option.Option(String),
) -> Result(Entry, FilesystemError)
Validate a symbolic-link observation, storing size zero and no content hash.
Require mtime within the nonnegative safe integer range and a nonempty file_id when supplied. The library does not resolve the link or read its target.
pub fn event_body_kind(body: EventBody) -> String
Return the stable kind label of a built-in event body.
pub fn event_body_source_kind(body: EventBody) -> SourceKind
Derive the source classification of a built-in event body.
pub fn event_continue_from(
parent parent: Event(parent_body),
id id: String,
occurred_at occurred_at: ValidDateTime,
source source: Source,
body body: body,
) -> Event(body)
Create an event with a new body while carrying the parent’s metadata forward.
Set causation to the parent’s id. Preserve its correlation id, including an absent correlation id. Preserve trace id and attributes. The new body may have a different type from the parent’s.
pub fn event_occurred_after(
event: Event(body),
after after: ValidDateTime,
) -> Bool
Return whether the event occurred strictly after the supplied civil time.
pub fn event_occurred_before(
event: Event(body),
before before: ValidDateTime,
) -> Bool
Return whether the event occurred strictly before the supplied civil time.
pub fn event_occurred_between(
event: Event(body),
from from: ValidDateTime,
until until: ValidDateTime,
) -> Bool
Return whether the event’s civil time is within the range, including both endpoints.
pub fn filesystem_event(
path path: NormalizedPath,
ops ops: set.Set(Op),
renamed_from from: option.Option(NormalizedPath),
) -> Result(WatchEvent, FilesystemError)
Construct an event with one or more operations.
Reject an empty operation set. A supplied old path requires Rename, but Rename may be used without an old path. The event’s main path is the new path for a rename.
Examples
import gleam/option.{None}
import gleam/set
let assert Ok(path) = path_normalize("/tmp/sample")
filesystem_event(path, set.new(), None)
// Error(EmptyOps)
let assert Ok(event) = filesystem_event(path, set.from_list([Write]), None)
filesystem_event_to_string(event)
// "WRITE /tmp/sample"
pub fn filesystem_event_ops(
event event: WatchEvent,
) -> set.Set(Op)
Read the nonempty set of observed operations.
pub fn filesystem_event_path(
event event: WatchEvent,
) -> NormalizedPath
Read the event’s path, which is the new path for a rename.
pub fn filesystem_event_renamed_from(
event event: WatchEvent,
) -> option.Option(NormalizedPath)
Read the old path when a rename carries one.
pub fn filesystem_event_to_string(
event event: WatchEvent,
) -> String
Render operations and path, for example CREATE|WRITE /tmp/a.
Append <- and the old path when present, as in RENAME /tmp/b <- /tmp/a. Operations use their canonical order.
pub fn ical_add_alarm(
event: IcalEvent,
alarm: IcalAlarm,
) -> IcalEvent
Append an alarm to the event, after its existing alarms.
pub fn ical_add_alarm_attendee(
alarm: IcalAlarm,
value: String,
) -> IcalAlarm
Append a attendee to the alarm.
Keep existing values and their parameters in order; the new value has no parsed parameters.
pub fn ical_add_attendee(
event: IcalEvent,
value: String,
) -> IcalEvent
Append a attendee to the event.
Keep existing values and their parameters in order; the new value has no parsed parameters.
pub fn ical_add_category(
event: IcalEvent,
value: String,
) -> IcalEvent
Append a category to the event.
Keep existing values and their parameters in order; the new value has no parsed parameters.
pub fn ical_add_event(
cal: IcalCalendar,
event: IcalEvent,
) -> IcalCalendar
Append a event to the calendar, preserving order within that component kind.
pub fn ical_add_exdate(
event: IcalEvent,
dt: DateTime,
) -> IcalEvent
Append a excluded date to the event.
Keep existing values and their parameters in order; the new value has no parsed parameters. The new date uses the default UTC form and is validated when encoded.
pub fn ical_add_freebusy(
cal: IcalCalendar,
fb: IcalFreeBusy,
) -> IcalCalendar
Append a free/busy component to the calendar, preserving order within that component kind.
pub fn ical_add_freebusy_attendee(
fb: IcalFreeBusy,
value: String,
) -> IcalFreeBusy
Append a attendee to the free/busy component.
Keep existing values and their parameters in order; the new value has no parsed parameters.
pub fn ical_add_freebusy_period(
fb: IcalFreeBusy,
value: String,
) -> IcalFreeBusy
Append a free/busy period string to the free/busy component.
Keep existing values and their parameters in order; the new value has no parsed parameters.
pub fn ical_add_journal(
cal: IcalCalendar,
j: IcalJournal,
) -> IcalCalendar
Append a journal to the calendar, preserving order within that component kind.
pub fn ical_add_journal_category(
j: IcalJournal,
value: String,
) -> IcalJournal
Append a category to the journal.
Keep existing values and their parameters in order; the new value has no parsed parameters.
pub fn ical_add_rdate(
event: IcalEvent,
dt: DateTime,
) -> IcalEvent
Append a additional date to the event.
Keep existing values and their parameters in order; the new value has no parsed parameters. The new date uses the default UTC form and is validated when encoded.
pub fn ical_add_timezone(
cal: IcalCalendar,
tz: IcalTimezone,
) -> IcalCalendar
Append a timezone to the calendar, preserving order within that component kind.
pub fn ical_add_timezone_daylight(
tz: IcalTimezone,
rule: IcalTimezoneRule,
) -> IcalTimezone
Append a DAYLIGHT rule to the timezone, after existing rules of that kind.
Existing rules keep their parameters. The new rule starts without parsed parameters and its DTSTART uses the floating form.
pub fn ical_add_timezone_standard(
tz: IcalTimezone,
rule: IcalTimezoneRule,
) -> IcalTimezone
Append a STANDARD rule to the timezone, after existing rules of that kind.
Existing rules keep their parameters. The new rule starts without parsed parameters and its DTSTART uses the floating form.
pub fn ical_add_todo(
cal: IcalCalendar,
t: IcalTodo,
) -> IcalCalendar
Append a task to the calendar, preserving order within that component kind.
pub fn ical_add_todo_alarm(
t: IcalTodo,
alarm: IcalAlarm,
) -> IcalTodo
Append an alarm to the task, after its existing alarms.
pub fn ical_add_todo_category(
t: IcalTodo,
value: String,
) -> IcalTodo
Append a category to the task.
Keep existing values and their parameters in order; the new value has no parsed parameters.
pub fn ical_add_todo_exdate(
t: IcalTodo,
dt: DateTime,
) -> IcalTodo
Append a excluded date to the task.
Keep existing values and their parameters in order; the new value has no parsed parameters. The new date uses the default UTC form and is validated when encoded.
pub fn ical_add_todo_rdate(t: IcalTodo, dt: DateTime) -> IcalTodo
Append a additional date to the task.
Keep existing values and their parameters in order; the new value has no parsed parameters. The new date uses the default UTC form and is validated when encoded.
pub fn ical_add_unknown_component(
cal: IcalCalendar,
component: IcalUnknownComponent,
) -> IcalCalendar
Append a unknown component to the calendar, preserving order within that component kind.
pub fn ical_alarm_attendees(a: IcalAlarm) -> List(String)
Read the alarm’s attendees in their stored order.
pub fn ical_alarm_description(
a: IcalAlarm,
) -> option.Option(String)
Read DESCRIPTION from the alarm.
pub fn ical_alarm_duration(a: IcalAlarm) -> option.Option(String)
Read DURATION from the alarm.
pub fn ical_alarm_repeat(a: IcalAlarm) -> option.Option(Int)
Read REPEAT from the alarm.
pub fn ical_alarm_summary(a: IcalAlarm) -> option.Option(String)
Read SUMMARY from the alarm.
pub fn ical_alarm_trigger(a: IcalAlarm) -> String
Read TRIGGER from the alarm.
pub fn ical_alarm_x_properties(
a: IcalAlarm,
) -> dict.Dict(String, String)
Read the alarm’s extension-property name/value map.
pub fn ical_calendar_x_properties(
cal: IcalCalendar,
) -> dict.Dict(String, String)
Read the calendar’s extension-property name/value map.
pub fn ical_calscale(cal: IcalCalendar) -> option.Option(String)
Read CALSCALE from the calendar.
pub fn ical_encode(
calendar: IcalCalendar,
) -> Result(String, IcalEncodeError)
Encode a calendar with CRLF endings and folding at 75 UTF-8 bytes per physical line.
Check typed dates, representable years, and rendered logical lines in emission order, returning the first error. Dates must be real whole-second civil values, including fields emitted as DATE. Wire years range from -999 through 9999; negative years use the parser’s existing sign-plus-three-digits form. A raw line containing CR or LF is rejected.
Normalize CRLF and bare CR in typed TEXT to LF before escaping it. Getters continue to return the stored text; encoding and parsing can therefore normalize line endings. Preserve parsed raw-text handling and DATE/floating/UTC/TZID forms unless an update replaced them. This does not perform timezone conversion or complete RFC validation.
Emit component groups in timezone, event, task, journal, free/busy, unknown order, retaining order within each group. Folding includes the continuation space in its byte limit.
Examples
let calendar = ical_new_calendar("2.0", "example")
let assert Ok(wire) = ical_encode(calendar)
let assert Ok(_) = ical_parse(wire)
ical_new_calendar("2.0", "example")
|> ical_with_method("PUBLISH\nOTHER")
|> ical_encode
// Error(IcalPhysicalNewline("METHOD:PUBLISH\nOTHER"))
pub fn ical_event_alarms(event: IcalEvent) -> List(IcalAlarm)
Read the event’s alarms in their stored order.
pub fn ical_event_attendees(event: IcalEvent) -> List(String)
Read the event’s attendees in their stored order.
pub fn ical_event_categories(event: IcalEvent) -> List(String)
Read the event’s categories in their stored order.
pub fn ical_event_created(
event: IcalEvent,
) -> option.Option(DateTime)
Read CREATED from the event.
pub fn ical_event_description(
event: IcalEvent,
) -> option.Option(String)
Read DESCRIPTION from the event.
pub fn ical_event_dtend(
event: IcalEvent,
) -> option.Option(DateTime)
Read DTEND from the event.
pub fn ical_event_dtend_tzid(
event: IcalEvent,
) -> option.Option(String)
Read DTEND timezone label from the event.
pub fn ical_event_dtstart(
event: IcalEvent,
) -> option.Option(DateTime)
Read DTSTART from the event.
pub fn ical_event_dtstart_tzid(
event: IcalEvent,
) -> option.Option(String)
Read DTSTART timezone label from the event.
pub fn ical_event_duration(
event: IcalEvent,
) -> option.Option(String)
Read DURATION from the event.
pub fn ical_event_exdates(event: IcalEvent) -> List(DateTime)
Read the event’s excluded dates in their stored order.
pub fn ical_event_last_modified(
event: IcalEvent,
) -> option.Option(DateTime)
Read LAST-MODIFIED from the event.
pub fn ical_event_location(
event: IcalEvent,
) -> option.Option(String)
Read LOCATION from the event.
pub fn ical_event_organizer(
event: IcalEvent,
) -> option.Option(String)
Read ORGANIZER from the event.
pub fn ical_event_rdates(event: IcalEvent) -> List(DateTime)
Read the event’s additional dates in their stored order.
pub fn ical_event_rrule(
event: IcalEvent,
) -> option.Option(RawRRule)
Read RRULE from the event.
pub fn ical_event_sequence(event: IcalEvent) -> Int
Read SEQUENCE from the event.
pub fn ical_event_status(
event: IcalEvent,
) -> option.Option(String)
Read STATUS from the event.
pub fn ical_event_summary(
event: IcalEvent,
) -> option.Option(String)
Read SUMMARY from the event.
pub fn ical_event_transparency(
event: IcalEvent,
) -> option.Option(String)
Read TRANSP from the event.
pub fn ical_event_url(event: IcalEvent) -> option.Option(String)
Read URL from the event.
pub fn ical_event_x_properties(
event: IcalEvent,
) -> dict.Dict(String, String)
Read the event’s extension-property name/value map.
pub fn ical_events(cal: IcalCalendar) -> List(IcalEvent)
Read the calendar’s events in their stored order.
pub fn ical_freebusy(cal: IcalCalendar) -> List(IcalFreeBusy)
Read the calendar’s free/busy components in their stored order.
pub fn ical_freebusy_attendees(fb: IcalFreeBusy) -> List(String)
Read the free/busy component’s attendees in their stored order.
pub fn ical_freebusy_dtend(
fb: IcalFreeBusy,
) -> option.Option(DateTime)
Read DTEND from the free/busy component.
pub fn ical_freebusy_dtstamp(fb: IcalFreeBusy) -> DateTime
Read DTSTAMP from the free/busy component.
pub fn ical_freebusy_dtstart(
fb: IcalFreeBusy,
) -> option.Option(DateTime)
Read DTSTART from the free/busy component.
pub fn ical_freebusy_organizer(
fb: IcalFreeBusy,
) -> option.Option(String)
Read ORGANIZER from the free/busy component.
pub fn ical_freebusy_periods(fb: IcalFreeBusy) -> List(String)
Read the free/busy component’s free/busy period strings in their stored order.
pub fn ical_freebusy_uid(fb: IcalFreeBusy) -> String
Read UID from the free/busy component.
pub fn ical_freebusy_x_properties(
fb: IcalFreeBusy,
) -> dict.Dict(String, String)
Read the free/busy component’s extension-property name/value map.
pub fn ical_journal_categories(j: IcalJournal) -> List(String)
Read the journal’s categories in their stored order.
pub fn ical_journal_description(
j: IcalJournal,
) -> option.Option(String)
Read DESCRIPTION from the journal.
pub fn ical_journal_dtstamp(j: IcalJournal) -> DateTime
Read DTSTAMP from the journal.
pub fn ical_journal_dtstart(
j: IcalJournal,
) -> option.Option(DateTime)
Read DTSTART from the journal.
pub fn ical_journal_status(
j: IcalJournal,
) -> option.Option(String)
Read STATUS from the journal.
pub fn ical_journal_summary(
j: IcalJournal,
) -> option.Option(String)
Read SUMMARY from the journal.
pub fn ical_journal_x_properties(
j: IcalJournal,
) -> dict.Dict(String, String)
Read the journal’s extension-property name/value map.
pub fn ical_journals(cal: IcalCalendar) -> List(IcalJournal)
Read the calendar’s journals in their stored order.
pub fn ical_method(cal: IcalCalendar) -> option.Option(String)
Read METHOD from the calendar.
pub fn ical_new_alarm(
action action: String,
trigger trigger: String,
) -> IcalAlarm
Create an alarm with ACTION and TRIGGER and no optional properties or attendees.
The trigger remains a string. ical_encode checks its rendered line for physical newlines, without interpreting the trigger as a duration or date.
pub fn ical_new_calendar(
version version: String,
prod_id prod_id: String,
) -> IcalCalendar
Create an empty calendar with the supplied VERSION and PRODID.
Optional properties and component lists start empty. Values are stored as supplied; wire validation occurs in ical_encode.
pub fn ical_new_event(
uid uid: String,
dtstamp dtstamp: DateTime,
) -> IcalEvent
Create an event with UID, DTSTAMP, and sequence zero.
Optional properties and repeated values start empty. Dates use the default UTC wire form until a timezone label or preserved form applies; no time conversion is performed. ical_encode validates the date and wire values.
pub fn ical_new_freebusy(
uid uid: String,
dtstamp dtstamp: DateTime,
) -> IcalFreeBusy
Create a free/busy component with UID and DTSTAMP and no optional properties or periods.
ical_encode validates the stored date and wire values.
pub fn ical_new_journal(
uid uid: String,
dtstamp dtstamp: DateTime,
) -> IcalJournal
Create a journal with UID and DTSTAMP, leaving optional properties and categories empty.
ical_encode validates the stored date and wire values.
pub fn ical_new_timezone(tzid tzid: String) -> IcalTimezone
Create a timezone with TZID and no rules or optional properties.
The timezone is stored as calendar data; it is not used to convert schedule times.
pub fn ical_new_todo(
uid uid: String,
dtstamp dtstamp: DateTime,
) -> IcalTodo
Create a task with UID and DTSTAMP, leaving optional properties and repeated values empty.
ical_encode validates the stored date and wire values.
pub fn ical_parse(
input: String,
) -> Result(IcalCalendar, IcalError)
Parse and validate an iCalendar document.
Return typed events, tasks, journals, free/busy components, timezones, alarms, and unknown components. Preserve supported property parameters and date forms. See ical_parse_raw for physical input handling and ical_validate for the validation boundary.
pub fn ical_parse_raw(
input: String,
) -> Result(IcalRawCalendar, IcalError)
Read an iCalendar document into a raw property/component tree.
Unfold continuation lines and retain property parameters, raw values, and line positions. Accept CRLF, LF, and bare CR physical line endings. Remove one leading BOM only; preserve U+FEFF elsewhere. Typed component requirements are checked separately by ical_validate.
pub fn ical_product_id(cal: IcalCalendar) -> String
Read PRODID from the calendar.
pub fn ical_timezone_daylight(
tz: IcalTimezone,
) -> List(IcalTimezoneRule)
Read the timezone’s DAYLIGHT rules in their stored order.
pub fn ical_timezone_last_modified(
tz: IcalTimezone,
) -> option.Option(DateTime)
Read LAST-MODIFIED from the timezone.
pub fn ical_timezone_standard(
tz: IcalTimezone,
) -> List(IcalTimezoneRule)
Read the timezone’s STANDARD rules in their stored order.
pub fn ical_timezone_tzid(tz: IcalTimezone) -> String
Read TZID from the timezone.
pub fn ical_timezone_tzurl(
tz: IcalTimezone,
) -> option.Option(String)
Read TZURL from the timezone.
pub fn ical_timezone_x_properties(
tz: IcalTimezone,
) -> dict.Dict(String, String)
Read the timezone’s extension-property name/value map.
pub fn ical_timezones(cal: IcalCalendar) -> List(IcalTimezone)
Read the calendar’s timezones in their stored order.
pub fn ical_todo_alarms(t: IcalTodo) -> List(IcalAlarm)
Read the task’s alarms in their stored order.
pub fn ical_todo_categories(t: IcalTodo) -> List(String)
Read the task’s categories in their stored order.
pub fn ical_todo_completed(
t: IcalTodo,
) -> option.Option(DateTime)
Read COMPLETED from the task.
pub fn ical_todo_description(
t: IcalTodo,
) -> option.Option(String)
Read DESCRIPTION from the task.
pub fn ical_todo_dtstart(t: IcalTodo) -> option.Option(DateTime)
Read DTSTART from the task.
pub fn ical_todo_due(t: IcalTodo) -> option.Option(DateTime)
Read DUE from the task.
pub fn ical_todo_exdates(t: IcalTodo) -> List(DateTime)
Read the task’s excluded dates in their stored order.
pub fn ical_todo_percent_complete(
t: IcalTodo,
) -> option.Option(Int)
Read PERCENT-COMPLETE from the task.
pub fn ical_todo_priority(t: IcalTodo) -> option.Option(Int)
Read PRIORITY from the task.
pub fn ical_todo_rdates(t: IcalTodo) -> List(DateTime)
Read the task’s additional dates in their stored order.
pub fn ical_todo_rrule(t: IcalTodo) -> option.Option(RawRRule)
Read RRULE from the task.
pub fn ical_todo_status(t: IcalTodo) -> option.Option(String)
Read STATUS from the task.
pub fn ical_todo_summary(t: IcalTodo) -> option.Option(String)
Read SUMMARY from the task.
pub fn ical_todo_x_properties(
t: IcalTodo,
) -> dict.Dict(String, String)
Read the task’s extension-property name/value map.
pub fn ical_todos(cal: IcalCalendar) -> List(IcalTodo)
Read the calendar’s tasks in their stored order.
pub fn ical_unknown_components(
cal: IcalCalendar,
) -> List(IcalUnknownComponent)
Read the calendar’s unknown components in their stored order.
pub fn ical_validate(
raw: IcalRawCalendar,
) -> Result(IcalCalendar, IcalError)
Interpret a raw calendar as typed components and preserved unknown components.
Check required properties and supported date, integer, escape, and RRULE syntax. RRULE values remain raw rules; this step does not validate them for scheduling. Keep DATE, floating, UTC, TZID, and parameter forms for later encoding. This is not a complete RFC conformance check.
pub fn ical_with_alarm_description(
alarm: IcalAlarm,
value: String,
) -> IcalAlarm
Set DESCRIPTION on the alarm and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_alarm_duration(
alarm: IcalAlarm,
value: String,
) -> IcalAlarm
Set DURATION on the alarm and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_alarm_repeat(
alarm: IcalAlarm,
value: Int,
) -> IcalAlarm
Set REPEAT on the alarm and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_alarm_summary(
alarm: IcalAlarm,
value: String,
) -> IcalAlarm
Set SUMMARY on the alarm and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_alarm_x_property(
alarm: IcalAlarm,
name: String,
value: String,
) -> IcalAlarm
Set an extension property on the alarm, replacing any value with the same name.
Discard the preserved form for that name, even when the value is unchanged.
pub fn ical_with_calendar_x_property(
cal: IcalCalendar,
name: String,
value: String,
) -> IcalCalendar
Set an extension property on the calendar, replacing any value with the same name.
Discard the preserved form for that name, even when the value is unchanged.
pub fn ical_with_calscale(
cal: IcalCalendar,
scale: String,
) -> IcalCalendar
Set CALSCALE on the calendar and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_created(
event: IcalEvent,
dt: DateTime,
) -> IcalEvent
Set CREATED on the event and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms. The date is validated when encoded.
pub fn ical_with_description(
event: IcalEvent,
value: String,
) -> IcalEvent
Set DESCRIPTION on the event and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_dtend(
event: IcalEvent,
dt: DateTime,
) -> IcalEvent
Set DTEND on the event and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms. If DTSTART was a DATE-only value, reset its form too. The default is UTC DATE-TIME unless an explicit timezone label applies; the civil value is not converted. The date is validated when encoded.
pub fn ical_with_dtend_tzid(
event: IcalEvent,
tzid: String,
) -> IcalEvent
Set the event’s DTEND timezone label without converting its civil time.
This explicit label overrides a parsed TZID during encoding; other preserved parameters remain.
pub fn ical_with_dtstart(
event: IcalEvent,
dt: DateTime,
) -> IcalEvent
Set DTSTART on the event and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms. If DTEND was a DATE-only value, reset its form too. The default is UTC DATE-TIME unless an explicit timezone label applies; the civil value is not converted. The date is validated when encoded.
pub fn ical_with_dtstart_tzid(
event: IcalEvent,
tzid: String,
) -> IcalEvent
Set the event’s DTSTART timezone label without converting its civil time.
This explicit label overrides a parsed TZID during encoding; other preserved parameters remain.
pub fn ical_with_duration(
event: IcalEvent,
value: String,
) -> IcalEvent
Set DURATION on the event and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_event_x_property(
event: IcalEvent,
name: String,
value: String,
) -> IcalEvent
Set EVENT-X-PROPERTY on the event and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_freebusy_dtend(
fb: IcalFreeBusy,
dt: DateTime,
) -> IcalFreeBusy
Set DTEND on the free/busy component and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms. The date is validated when encoded.
pub fn ical_with_freebusy_dtstart(
fb: IcalFreeBusy,
dt: DateTime,
) -> IcalFreeBusy
Set DTSTART on the free/busy component and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms. The date is validated when encoded.
pub fn ical_with_freebusy_organizer(
fb: IcalFreeBusy,
value: String,
) -> IcalFreeBusy
Set ORGANIZER on the free/busy component and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_freebusy_x_property(
fb: IcalFreeBusy,
name: String,
value: String,
) -> IcalFreeBusy
Set an extension property on the free/busy component, replacing any value with the same name.
Discard the preserved form for that name, even when the value is unchanged.
pub fn ical_with_journal_description(
j: IcalJournal,
value: String,
) -> IcalJournal
Set DESCRIPTION on the journal and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_journal_dtstart(
j: IcalJournal,
dt: DateTime,
) -> IcalJournal
Set DTSTART on the journal and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms. The date is validated when encoded.
pub fn ical_with_journal_status(
j: IcalJournal,
value: String,
) -> IcalJournal
Set STATUS on the journal and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_journal_summary(
j: IcalJournal,
value: String,
) -> IcalJournal
Set SUMMARY on the journal and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_journal_x_property(
j: IcalJournal,
name: String,
value: String,
) -> IcalJournal
Set an extension property on the journal, replacing any value with the same name.
Discard the preserved form for that name, even when the value is unchanged.
pub fn ical_with_last_modified(
event: IcalEvent,
dt: DateTime,
) -> IcalEvent
Set LAST-MODIFIED on the event and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms. The date is validated when encoded.
pub fn ical_with_location(
event: IcalEvent,
value: String,
) -> IcalEvent
Set LOCATION on the event and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_method(
cal: IcalCalendar,
method: String,
) -> IcalCalendar
Set METHOD on the calendar and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_organizer(
event: IcalEvent,
value: String,
) -> IcalEvent
Set ORGANIZER on the event and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_rrule(
event: IcalEvent,
rule: RawRRule,
) -> IcalEvent
Set RRULE on the event and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_sequence(
event: IcalEvent,
value: Int,
) -> IcalEvent
Set SEQUENCE on the event and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_status(
event: IcalEvent,
value: String,
) -> IcalEvent
Set STATUS on the event and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_summary(
event: IcalEvent,
value: String,
) -> IcalEvent
Set SUMMARY on the event and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_timezone_last_modified(
tz: IcalTimezone,
dt: DateTime,
) -> IcalTimezone
Set LAST-MODIFIED on the timezone and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms. The date is validated when encoded.
pub fn ical_with_timezone_url(
tz: IcalTimezone,
value: String,
) -> IcalTimezone
Set TZURL on the timezone and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_timezone_x_property(
tz: IcalTimezone,
name: String,
value: String,
) -> IcalTimezone
Set an extension property on the timezone, replacing any value with the same name.
Discard the preserved form for that name, even when the value is unchanged.
pub fn ical_with_todo_completed(
t: IcalTodo,
dt: DateTime,
) -> IcalTodo
Set COMPLETED on the task and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms. The date is validated when encoded.
pub fn ical_with_todo_description(
t: IcalTodo,
value: String,
) -> IcalTodo
Set DESCRIPTION on the task and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_todo_dtstart(
t: IcalTodo,
dt: DateTime,
) -> IcalTodo
Set DTSTART on the task and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms. If DUE was a DATE-only value, reset its form too. The default is UTC DATE-TIME unless an explicit timezone label applies; the civil value is not converted. The date is validated when encoded.
pub fn ical_with_todo_due(t: IcalTodo, dt: DateTime) -> IcalTodo
Set DUE on the task and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms. If DTSTART was a DATE-only value, reset its form too. The default is UTC DATE-TIME unless an explicit timezone label applies; the civil value is not converted. The date is validated when encoded.
pub fn ical_with_todo_percent_complete(
t: IcalTodo,
value: Int,
) -> IcalTodo
Set PERCENT-COMPLETE on the task and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_todo_priority(
t: IcalTodo,
value: Int,
) -> IcalTodo
Set PRIORITY on the task and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_todo_rrule(
t: IcalTodo,
rule: RawRRule,
) -> IcalTodo
Set RRULE on the task and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_todo_status(
t: IcalTodo,
value: String,
) -> IcalTodo
Set STATUS on the task and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_todo_summary(
t: IcalTodo,
value: String,
) -> IcalTodo
Set SUMMARY on the task and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_todo_x_property(
t: IcalTodo,
name: String,
value: String,
) -> IcalTodo
Set an extension property on the task, replacing any value with the same name.
Discard the preserved form for that name, even when the value is unchanged.
pub fn ical_with_transparency(
event: IcalEvent,
value: String,
) -> IcalEvent
Set TRANSP on the event and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn ical_with_url(
event: IcalEvent,
value: String,
) -> IcalEvent
Set URL on the event and discard that property’s preserved form.
An update resets the form even when the value is unchanged. Other properties retain their values and forms.
pub fn op_to_string(op op: Op) -> String
Return CREATE, WRITE, REMOVE, RENAME, or CHMOD.
pub fn ops_to_list(ops ops: set.Set(Op)) -> List(Op)
List selected operations in Create, Write, Remove, Rename, Chmod order.
pub fn ops_to_string(ops ops: set.Set(Op)) -> String
Join selected operation labels with | in canonical order.
An empty set returns an empty string.
pub fn path_is_absolute(path path: NormalizedPath) -> Bool
Return whether the normalized path is rooted or begins with a Windows drive-letter segment.
pub fn path_normalize(
path path: String,
) -> Result(NormalizedPath, FilesystemError)
Normalize and validate a portable path without consulting the filesystem.
Replace backslashes with slashes, collapse repeated separators, and remove trailing separators except for roots. Reject empty input, NUL, dot or dot-dot segments, and exactly two leading separators used for UNC paths. Three or more leading separators form a single rooted path. Preserve case; do not resolve symbolic links.
Examples
let assert Ok(path) = path_normalize("/tmp//sample/")
path_to_string(path)
// "/tmp/sample"
path_normalize("/tmp/../sample")
// Error(PathContainsDotSegment("/tmp/../sample", ".."))
pub fn path_segments(path path: NormalizedPath) -> List(String)
Read the path segments in order, without separator characters.
pub fn path_starts_with(
path path: NormalizedPath,
prefix prefix: NormalizedPath,
) -> Bool
Test a path prefix by complete segments, including equality.
Absolute and relative paths cannot match each other. /var/log is below /var, but not below /var/lo.
pub fn path_to_string(path path: NormalizedPath) -> String
Read the normalized path string.
pub fn retry_capped_exponential(
initial initial: duration.Duration,
multiplier multiplier: Int,
cap cap: duration.Duration,
max_attempts max_attempts: Int,
) -> Result(RetryPolicy, RetryError)
Create an exponential retry policy with a maximum base delay.
Validate the initial duration and cap first, then require a positive initial delay, multiplier at least two, positive max_attempts, and cap at least initial. Apply the cap before jitter. Both durations must be nonnegative whole milliseconds within the supported range.
pub fn retry_cumulative_delay(
ctx ctx: RetryContext,
) -> duration.Duration
Read the total delay selected by earlier retry decisions.
pub fn retry_current_attempt(ctx ctx: RetryContext) -> Int
Read the zero-based attempt number in the context.
pub fn retry_decide(
ctx ctx: RetryContext,
failure failure: FailureKind,
) -> RetryDecision
Choose whether to retry after the current attempt fails.
A permanent failure gives up before policy or attempt-limit checks. For a transient failure, apply the policy, attempt limit, delay range, jitter, and cumulative-delay range. Retry returns the delay and the context for the next attempt; callers execute that action themselves.
pub fn retry_exponential(
initial initial: duration.Duration,
multiplier multiplier: Int,
max_attempts max_attempts: Int,
) -> Result(RetryPolicy, RetryError)
Create an exponential retry policy.
The first retry uses the initial delay; each later retry multiplies it by the multiplier. Check the duration, then require a positive initial delay, multiplier at least two, and positive max_attempts. The attempt limit includes the initial attempt. A delay that exceeds the supported range during execution gives up with DelayOverflow.
pub fn retry_fixed(
delay delay: duration.Duration,
max_attempts max_attempts: Int,
) -> Result(RetryPolicy, RetryError)
Create a policy with a fixed delay between attempts.
Check that max_attempts is positive, then validate the delay. Zero delay is allowed. Delays must be nonnegative whole milliseconds no greater than 9,007,199,254,740,991 milliseconds. The attempt limit includes the initial attempt.
Examples
import gleam/time/duration
retry_fixed(duration.milliseconds(100), 0)
// Error(MaxAttemptsMustBePositive(0))
let assert Ok(policy) = retry_fixed(duration.milliseconds(100), 2)
let context = retry_start(policy, seed: 42)
let assert Retry(delay, next) = retry_decide(context, failure: Transient)
duration.to_seconds_and_nanoseconds(delay)
// #(0, 100_000_000)
retry_current_attempt(next)
// 1
pub fn retry_jitter(
policy policy: RetryPolicy,
jitter jitter: Jitter,
) -> RetryPolicy
Choose how the policy varies each retry delay.
NoJitter keeps the base delay. FullJitter chooses an integer number of milliseconds from zero through the base; EqualJitter chooses from half the base, rounded down, through the base. Choices are determined by the context’s seed.
pub fn retry_no_retry() -> RetryPolicy
Return a policy that never schedules another attempt.
pub fn retry_policy(ctx ctx: RetryContext) -> RetryPolicy
Read the policy held by the retry context.
pub fn retry_start(
policy policy: RetryPolicy,
seed seed: Int,
) -> RetryContext
Start a deterministic retry context at attempt zero with no accumulated delay.
The same policy, seed, and failure sequence produce the same decisions on both targets. The context computes decisions and does not sleep or perform the work.
pub fn rrule_new(
options: RecurrenceOptions,
) -> Result(RecurrenceRule, RruleValidationError)
Validate typed recurrence options without choosing an anchor.
Check interval, end condition, BYDAY, BYMONTH, BYMONTHDAY, BYHOUR, then BYMINUTE and combined constraints. Intervals and counts must be positive and exactly representable on the target. Reject empty supplied filters. UNTIL uses years 0 through 9999; a DateTime end must have zero nanoseconds.
Examples
let options = rrule_options(Daily)
let assert Ok(rule) = rrule_new(RecurrenceOptions(
..options, end_condition: Count(2),
))
rrule_to_options(rule).end_condition
// Count(2)
rrule_new(RecurrenceOptions(..options, interval: 0))
// Error(RruleMustBePositive(IntervalPart, 0))
pub fn rrule_options(frequency: Frequency) -> RecurrenceOptions
Return options for the given frequency, with interval one, no end, and no BY filters.
Update the record and pass it to rrule_new. Omitted fields use frequency-dependent defaults when the rule is anchored by schedule_from_rrule.
pub fn rrule_parse_raw(
input input: String,
) -> Result(RawRRule, RruleParseError)
Parse RRULE syntax while preserving its ordered name/value parts.
This stage does not check supported frequencies, duplicate parts, or value ranges. Call rrule_validate for those checks. Raw rules can also be stored in iCalendar components without compiling a schedule.
pub fn rrule_to_options(
rule: RecurrenceRule,
) -> RecurrenceOptions
Return the validated rule as ordinary recurrence options.
Selectors are normalized. Validate any record updates with rrule_new before scheduling them.
pub fn rrule_to_string(spec spec: RecurrenceRule) -> String
Render the validated rule as a canonical RRULE string.
pub fn rrule_validate(
raw raw: RawRRule,
) -> Result(RecurrenceRule, RruleValidationError)
Validate a raw recurrence rule for the supported scheduler subset.
Support all seven frequencies, INTERVAL, COUNT or UNTIL, BYDAY, BYMONTH, BYMONTHDAY, BYHOUR, and BYMINUTE. Week starts must be Monday. Reject duplicate or unsupported parts, invalid ranges, and incompatible combinations. COUNT and UNTIL cannot be combined. UNTIL dates use years 0 through 9999; DATE-TIME requires UTC Z notation.
pub fn run(
automaton: Automaton(state, symbol),
inputs: List(symbol),
) -> state
Apply the transition function to each input, starting from the initial state.
Return the final state. Empty input returns initial_state; acceptance is not checked.
pub fn schedule_every(
interval_seconds interval_seconds: Int,
anchor anchor: ValidDateTime,
) -> Result(Schedule, ScheduleError)
Create a fixed-interval schedule beginning at the anchor.
Require a positive interval in seconds; JavaScript also requires an exactly representable safe integer. Occurrences include the anchor and advance by whole intervals without timezone conversion.
pub fn schedule_from_cron(cron: Cron) -> Schedule
Compile a validated cron specification into a reusable schedule.
Occurrences fall at second zero. The schedule holds its lookup data, so it can be reused for matching and iteration.
pub fn schedule_from_rrule(
rule: RecurrenceRule,
anchor anchor: ValidDateTime,
) -> Schedule
Anchor a validated recurrence rule and prepare its schedule.
The anchor supplies omitted date/time fields according to frequency. COUNT counts occurrences from this anchor, including when a later query starts partway through the sequence. Invalid calendar dates are skipped rather than clamped. UNTIL includes its final date or second.
pub fn schedule_iterator(
schedule: Schedule,
boundary boundary: Boundary,
) -> Result(OccurrenceIterator, ScheduleError)
Prepare an immutable occurrence iterator at an inclusive or exclusive boundary.
For COUNT-limited rules, account for occurrences before the boundary instead of restarting the count. This work can return a search-limit or numeric error. The iterator owns no external resource; stepping the same value again returns the same result.
pub fn schedule_matches(
schedule: Schedule,
at at: ValidDateTime,
) -> Result(Bool, ScheduleError)
Check whether the schedule matches a validated civil time.
Cron matching uses the minute and ignores the seconds field, while cron iteration emits second zero. Recurrence COUNT is measured from the original anchor. Return a search-limit or numeric error if the answer cannot be determined within the supported computation limits.
pub fn schedule_next(
schedule: Schedule,
after after: ValidDateTime,
) -> Result(option.Option(ValidDateTime), ScheduleError)
Find the first occurrence strictly after the supplied time.
Return Ok(None) for a finished sequence. Search-limit and numeric failures remain errors. For an inclusive start or repeated traversal, use schedule_iterator and schedule_step.
pub fn schedule_once(at: ValidDateTime) -> Schedule
Create a schedule containing exactly the supplied occurrence.
pub fn schedule_step(
iterator: OccurrenceIterator,
) -> Result(IterStep, ScheduleError)
Return the next occurrence and continuation, or Done for a finished sequence.
Done means an end condition was reached or a complete empty calendar cycle was established. Reaching the search work limit or the target’s exact numeric range returns an error. A yielded final occurrence remains available even when there is no representable later time.
pub fn snapshot_add(
snapshot snapshot: Snapshot,
entry entry: Entry,
) -> Result(Snapshot, FilesystemError)
Add an entry to a snapshot, rejecting a path already present.
pub fn snapshot_entries(
snapshot snapshot: Snapshot,
) -> List(Entry)
Return snapshot entries in normalized-path order.
pub fn snapshot_from_entries(
entries entries: List(Entry),
) -> Result(Snapshot, FilesystemError)
Create a snapshot keyed by normalized path.
Reject duplicate paths instead of overwriting an entry.
pub fn snapshot_get(
snapshot snapshot: Snapshot,
path path: NormalizedPath,
) -> option.Option(Entry)
Find the entry at a normalized path, or return None.
pub fn snapshot_size(snapshot snapshot: Snapshot) -> Int
Return the number of entries in the snapshot.
pub fn source_kind_to_string(kind: SourceKind) -> String
Return the stable source label.
Built-in labels include schedule, file_system, manual, and their transport names. A custom source returns custom: followed by its name.
pub fn weekday_to_string(day: calendar.DayOfWeek) -> String
Return the RRULE weekday label: MO, TU, WE, TH, FR, SA, or SU.