automata/rrule/validator

Types

pub type EndCondition {
  Forever
  Count(Int)
  Until(Until)
}

Constructors

  • Forever
  • Count(Int)
  • Until(Until)
pub type Frequency {
  Secondly
  Minutely
  Hourly
  Daily
  Weekly
  Monthly
  Yearly
}

Constructors

  • Secondly
  • Minutely
  • Hourly
  • Daily
  • Weekly
  • Monthly
  • Yearly
pub type RulePart {
  FreqPart
  IntervalPart
  CountPart
  UntilPart
  ByDayPart
  ByMonthPart
  ByMonthDayPart
  ByHourPart
  ByMinutePart
}

Constructors

  • FreqPart
  • IntervalPart
  • CountPart
  • UntilPart
  • ByDayPart
  • ByMonthPart
  • ByMonthDayPart
  • ByHourPart
  • ByMinutePart
pub type Until {
  UntilDate(ast.Date)
  UntilDateTime(ast.DateTime)
}

Constructors

An RRULE that has passed validate/1. opaque so the only way to obtain a value is through validation, preventing callers from forging “validated” inputs.

pub opaque type ValidRRule
pub type ValidationError {
  MissingPart(part: RulePart)
  DuplicatePart(part: RulePart)
  UnknownPart(name: String)
  UnsupportedPart(name: String)
  InvalidNumber(part: RulePart, value: String)
  InvalidPartValue(part: RulePart, value: String)
  InvalidList(part: RulePart, value: String)
  OutOfRange(part: RulePart, min: Int, max: Int, actual: Int)
  MustBePositive(part: RulePart, actual: Int)
  MutuallyExclusiveParts(left: RulePart, right: RulePart)
  NumericWeekdayRequiresMonthlyOrYearly(frequency: Frequency)
  ImpossibleDate(by_month: String, by_month_day: String)
  IncompatibleFrequencyAndPart(
    frequency: Frequency,
    part: RulePart,
  )
  UntilMissingZ(value: String)
  UntilLocalFormUnsupported(value: String, reason: String)
  UntilMalformedDateTime(value: String)
}

Constructors

  • MissingPart(part: RulePart)
  • DuplicatePart(part: RulePart)
  • UnknownPart(name: String)
  • UnsupportedPart(name: String)
  • InvalidNumber(part: RulePart, value: String)
  • InvalidPartValue(part: RulePart, value: String)
  • InvalidList(part: RulePart, value: String)
  • OutOfRange(part: RulePart, min: Int, max: Int, actual: Int)
  • MustBePositive(part: RulePart, actual: Int)
  • MutuallyExclusiveParts(left: RulePart, right: RulePart)
  • NumericWeekdayRequiresMonthlyOrYearly(frequency: Frequency)
  • ImpossibleDate(by_month: String, by_month_day: String)
  • IncompatibleFrequencyAndPart(
      frequency: Frequency,
      part: RulePart,
    )
  • UntilMissingZ(value: String)

    UNTIL was given in FORM #3 (local DATE-TIME) shape — either the length-15 YYYYMMDDTHHMMSS form or a length-16 YYYYMMDDTHHMMSS_ where the trailing character is not Z. RFC 5545 §3.3.10 accepts FORM #3 only when DTSTART is also local time, and validate runs anchor-less; the caller almost always means UTC and just forgot the Z suffix.

  • UntilLocalFormUnsupported(value: String, reason: String)

    UNTIL was syntactically a valid FORM #3 local DATE-TIME but automata/rrule.validate refuses it because the validator has no DTSTART context with which to check the RFC 5545 §3.8.5.3 “same value type as DTSTART” rule. reason carries the human- readable explanation for use in error reports.

  • UntilMalformedDateTime(value: String)

    UNTIL was neither a recognisable DATE (YYYYMMDD) nor a recognisable DATE-TIME (YYYYMMDDTHHMMSSZ): wrong length, bad numeric components, or missing the T separator at position 8.

pub type WeekdaySpecifier {
  EveryWeekday(ast.Weekday)
  NthWeekday(Int, ast.Weekday)
}

Constructors

Values

pub fn by_day(
  spec: ValidRRule,
) -> option.Option(List(WeekdaySpecifier))
pub fn by_hour(spec: ValidRRule) -> option.Option(List(Int))
pub fn by_minute(spec: ValidRRule) -> option.Option(List(Int))
pub fn by_month(spec: ValidRRule) -> option.Option(List(Int))
pub fn by_month_day(spec: ValidRRule) -> option.Option(List(Int))
pub fn end_condition(spec: ValidRRule) -> EndCondition
pub fn frequency(spec: ValidRRule) -> Frequency
pub fn interval(spec: ValidRRule) -> Int
pub fn to_string(spec: ValidRRule) -> String
pub fn validate(
  raw raw: ast.RawRRule,
) -> Result(ValidRRule, ValidationError)
Search Document