Skip to content

LiamSnow/ical-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ical-rs

A flexbile and typed ICalendar (RFC 5545) library.

Features

  • Full implemenation of every ICalendar type (see src/values).
  • Generated methods for every ICalendar property with all allowed types
  • Support for X & IANA properties and parameters

Usage

Modify Existing

let ics_str = "BEGIN:VCALENDAR...";
let mut vcal = ICalComponent::from_ics(ics_str)?;
let vtodo = vcal.expect_vtodo();
vtodo.summary("New Summary".to_string());
let new_ics_str = vcal.to_ics();

Make New

let dtstamp = Tz::America__New_York.with_ymd_and_hms(1992, 12, 17, 12, 34, 56)?;
let vcal = ICalComponent::vcalendar_with_vtodo(
    ICalComponent::empty()
        .uid_random()
        .dtstamp(dtstamp.into())
        .percent_complete(10)
        .build()
);
let ics_str = vcal.to_ics();

X & IANA Properties

Convert Value:

let in_ics = r#"BEGIN:VCALENDAR
X-EXAMPLE:19921217T123456
END:VCALENDAR"#;
let mut vcal = ICalComponent::from_ics(&in_ics)?;
let x_example = vcal.get_prop("X-EXAMPLE")?
    .convert_value::<ICalDateTime>()?;

Read Later:

let value = vcal.get_prop("X-EXAMPLE")?
    .get_as::<ICalDateTime>()?);
println!("{}", value); // 1992-12-17 12:34:56

About

A flexbile and typed ICalendar (RFC 5545) library.

Topics

Resources

License

Stars

Watchers

Forks

Languages