#ical #parser #rfc5545 #rfc7986

icalendar

强类型 iCalendar 构建器和解析器

36 个版本

新版本 0.16.3 2024 年 8 月 13 日
0.16.2 2024 年 7 月 7 日
0.16.1 2024 年 4 月 7 日
0.16.0 2023 年 11 月 22 日
0.1.0 2016 年 11 月 20 日

#41日期和时间

Download history 1465/week @ 2024-04-29 1160/week @ 2024-05-06 1718/week @ 2024-05-13 1571/week @ 2024-05-20 1115/week @ 2024-05-27 1465/week @ 2024-06-03 1242/week @ 2024-06-10 1836/week @ 2024-06-17 1135/week @ 2024-06-24 970/week @ 2024-07-01 986/week @ 2024-07-08 962/week @ 2024-07-15 1279/week @ 2024-07-22 1080/week @ 2024-07-29 507/week @ 2024-08-05 762/week @ 2024-08-12

3,675 每月下载量
16crate(15 个直接)中使用

MIT/Apache

165KB
3.5K SLoC

Rust 中的 iCalendar

build Crates.io contributors maintenance

version documentation license

rfc5545 iCalendar 的构建器[和解析器]。

你想要使这个库更加成熟吗?请与我联系,Pull Requests 和建议非常受欢迎。

示例

使用构建器模式组装完整的日历或事件。显示打印输出 rfc5545 格式。

// lets create a calendar
let my_calendar = Calendar::new()
    .name("example calendar")
    .push(
        // add an event
        Event::new()
            .summary("test event")
            .description("here I have something really important to do")
            .starts(Utc::now())
            .class(Class::Confidential)
            .ends(Utc::now() + Duration::days(1))
            .append_property(
                Property::new("TEST", "FOOBAR")
                    .add_parameter("IMPORTANCE", "very")
                    .add_parameter("DUE", "tomorrow")
                    .done(),
            )
            .done(),
    )
    .push(
        // add a todo
        Todo::new()
            .summary("groceries")
            .description("Buy some milk")
            .done(),
    )
    .push(
        // add an all-day event
        Event::new()
            .all_day(NaiveDate::from_ymd_opt(2016, 3, 15).unwrap())
            .summary("My Birthday")
            .description("Hey, I'm gonna have a party\nBYOB: Bring your own beer.\nHendrik")
            .done(),
    )
    .push(
        // local event with timezone
        Event::new()
            .starts(CalendarDateTime::from_ymd_hm_tzid(2023, 3, 15, 18, 45, Berlin).unwrap())
            .summary("Birthday Party")
            .description("I'm gonna have a party\nBYOB: Bring your own beer.\nHendrik")
            .done(),
    )
    .done();

println!("{}", my_calendar);

解析

有一个名为 "parser" 的功能,允许你再次像这样读取日历

//... continue from previous example

let parsed_calendar = my_calendar.parse::<Calendar>()?;

许可证

icalendar-rs 采用 Apache 许可证 2.0 版或 MIT 许可证。

任选其一。

贡献

欢迎以描述性和友好的 问题 或综合性的 pull requests 的形式提供的任何帮助!

除非你明确说明,否则你提交给 icalendar-rs 的任何贡献,根据 Apache-2.0 许可证的定义,都将采用上述双重许可,没有额外的条款或条件。

依赖关系

~2–10MB
~54K SLoC