Crate ics

Source
Expand description

A library for creating ICalendar files.

The library supports the ICalendar specification RFC5545 version 2.0 and also RFC7986.

§Installation

To use this library add the library as a dependency in your Cargo.toml:

[dependencies]
ics = "0.5"

By default some features are enabled. If you wish to disable them, specify in your Cargo.toml:

[dependencies.ics]
version = "0.5"
default-features = false

§Features

  • rfc7986 (enabled by default): adds properties from the newer specification RFC7986

§Example

use ics::properties::{Comment, Status, Summary};
use ics::{ICalendar, ToDo};

fn main() -> std::io::Result<()> {
    // Anything that can be converted to a Cow<str> is accepted as value which means
    // &str and String can be used freely. For the sake of demonstrating the UID was
    // taken from somewhere. Out of security reasons the UID should always be
    // randomly generated.
    let mut todo = ToDo::new("d4092ed9-1667-4518-a7c0-bcfaac4f1fc6", "20181021T190000");
    todo.push(Summary::new("Katarina's Birthday Present"));
    todo.push(Comment::new("Buy her Imagine Dragons tickets!"));
    todo.push(Status::needs_action());

    // The ICalendar object is what is later written to the file.
    let mut calendar = ICalendar::new("2.0", "ics-rs");
    calendar.add_todo(todo);

    // Write `calendar` to a file.
    calendar.save_file("birthday.ics")?;
    Ok(())
}

Modules§

components
Basic components for building custom calendar objects.
parameters
In the RFC5545 and RFC7986 specified parameters except for IANA and non-standard parameters (“X”-prefix parameters).
properties
In the RFC5545 and RFC7986 specified properties except for IANA and non-standard properties (“X”-prefix parameters).

Macros§

parameters
Macro to create several Parameters at once.

Structs§

Alarm
The VALARM calendar sub-component of VEVENT and VTODO.
Daylight
The DAYLIGHT calendar sub-component of VTIMEZONE
Event
The VEVENT calendar component
FreeBusy
The VFREEBUSY calendar component
ICalendar
The iCalendar object specified as VCALENDAR component
Journal
The VJOURNAL calendar component
Standard
The STANDARD calendar sub-component of VTIMEZONE
TimeZone
The VTIMEZONE calendar component
ToDo
The VTODO calendar component

Functions§

escape_text
Escapes comma, semicolon, backslash and newline character by prepending a backslash. Newlines are normalized to a line feed character.