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 在 日期和时间
3,675 每月下载量
在 16 个crate(15 个直接)中使用
165KB
3.5K SLoC
你想要使这个库更加成熟吗?请与我联系,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 许可证。
- Apache 许可证 2.0 版 (https://apache.ac.cn/licenses/LICENSE-2.0)
- MIT 许可证 (https://open-source.org.cn/licenses/MIT)
任选其一。
贡献
欢迎以描述性和友好的 问题 或综合性的 pull requests 的形式提供的任何帮助!
除非你明确说明,否则你提交给 icalendar-rs 的任何贡献,根据 Apache-2.0 许可证的定义,都将采用上述双重许可,没有额外的条款或条件。
依赖关系
~2–10MB
~54K SLoC