Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Rust crate for working with recurrence rules for calendar dates as defined in the iCalendar RFC and more.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

fmeringdal/rust-rrule

A pure and efficient Rust implementation of recurrence rules as defined in the iCalendar RFC.

Specification

This crate follows theiCalendar (RFC-5545) specification for the "Recurrence Rule".The Recurrence Rule spec corresponds to theRRule object in this crate.In addition, it allows for adding the"DTSTART" property separated by a newline.

The crate allows for a "BYEASTER" filter. But this is opt-in with the feature flag"by-easter".

RRuleSet

RRuleSet allows for a combination forRRules and some other properties.

  • List ofRRules:Allows multiple RRules to be combined. (Union,A ∪ B)
  • List ofRDates:A list of datetime combinations to always include. (Union,A ∪ B)
  • List ofExRule (see note below):Allows of RRules that are removed from the results. (ComplementA \ B orA - B)
  • List ofExDate:A list of datetime combinations to always exclude. (ComplementA \ B orA - B)

Note: "EXRULE" was originally part ofRFC 2445,RFC 5545 obsoletes this specification.But "EXRULE" works exactly the same als "RRULE" except that it excludes dates. You can enable "EXRULE" by enabling the "exrule" feature flag which is disabled by default.

If you notice that the implementation differs from the specifications above, please open an issue.

Library Usage

use rrule::RRuleSet;// RRule that starts 2012.02.01 and occurs daily for 3 days.let rrule:RRuleSet ="DTSTART:20120201T093000Z\nRRULE:FREQ=DAILY;COUNT=3".parse().unwrap();// Set hard limit in case of infinitely recurring rules.let limit =100;// Get all recurrences of the rrulelet result = rrule.all(limit);assert_eq!(result.dates.len(),3);

See more examples atdocs.rs

Command Line Tool Usage

Install the command line tool with:

cargo install rrule --features="cli-tool"

Then run it with:

rrule"DTSTART:20120201T093000Z\nRRULE:FREQ=DAILY;COUNT=3"

Security

You should read thesecurity docs if you use arbitrary inputs from users for constructing the recurrence rules.

Limitation and limits

All dates are limited to the range or years +/-262_0001 because ofChrono limits.SeeChrono's limits for more info.

Supported timezones are limited to by the timezones thatChrono-Tz supports.This is equivalent to the IANA database.SeeChrono-Tz's limits for more info.

Validation Limits

Because the specifications do give a lot of flexibilities this can beabused very easily.In order to prevent most of the abuse we've imposed arbitrary limitation when on theRRuleSet::allmethod. The validation limits aren't enforced for theRRuleSet::all_unchecked method or whenusing theIterator api directly.

Limitations:

DescriptionArbitrary LimitCrate Limit
Year range-10_000..=10_000-262_000..=262_000 (Chrono)
Max interval with freq Yearly10_000 (10000 years)65_535 (u16::MAX)
Max interval with freq Monthly1_000 (~83 years)65_535 (u16::MAX)
Max interval with freq Weekly1_000 (~19 years)65_535 (u16::MAX)
Max interval with freq Daily10_000 (~27 years)65_535 (u16::MAX)
Max interval with freq Hourly10_000 (~416 days)65_535 (u16::MAX)
Max interval with freq Minutely10_000 (~7 days)65_535 (u16::MAX)
Max interval with freq Secondly50_000 (~13 hours)65_535 (u16::MAX)
Iteration limit100_0004_294_967_295 (u32::MAX)

By default, the "Arbitrary Limit" is used. If you instead want to use the "Crate Limit".Make sure youunderstand the risks that come with this.

Inspired by

License

The code in this project is licensed under theMIT orApache 2.0 license.

All contributions to this project will be similarly licensed.

Footnotes

  1. Seevalidation limits sections more info.

About

Rust crate for working with recurrence rules for calendar dates as defined in the iCalendar RFC and more.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp