#ical #writer #vcard #fold

content-line-writer

Writer for icalendar/vcard content lines

4 releases

0.2.2 Mar 24, 2025
0.2.1 Mar 17, 2025
0.2.0 Mar 10, 2025
0.1.0 Aug 15, 2024

#336 in Date and time

Download history 1/week @ 2024-12-11 7/week @ 2025-02-05 89/week @ 2025-03-05 128/week @ 2025-03-12 127/week @ 2025-03-19 37/week @ 2025-03-26

381 downloads per month

ISC license

26KB
569 lines

This library provides ContentLineWriter, which writes content lines for iCalendar or vCard files.

The type state pattern is used to ensure that lines are not incomplete; a reference to the writer can only be recovered by writing a content line to completion.

Example

The following example serialises into a [Vec]. Any type implementing std::io::Write is usable as an output.

use content_line_writer::ContentLineWriter;

let buffer = Vec::<u8>::new();
let mut writer = ContentLineWriter::new(buffer);

writer = writer.start_line("BEGIN")
    .unwrap()
    .value("VEVENT")
    .unwrap();

let buffer = writer.into_inner();
let s = String::from_utf8(buffer).unwrap();

assert_eq!("BEGIN:VEVENT\r\n", s);

content-line-writer

Source | Docs | Issues | Patches | Chat

This Rust library implements writing of content lines for iCalendar and vCard files. It handles the lower-level details of these formats, including folding continuation lines.

The initial scope includes two usages:

  • Converting JSCalendar into iCalendar.
  • Fixing some types of errors in non-compliant iCalendar files.

It does not handle any of the semantics of iCalendar and vCard; it only handles the syntax of content lines.

Requirements

This library requires Rust and Cargo to built. It has no additional build or runtime dependencies.

Documentation

The documentation can be built with cargo doc.

Licence

This project is licensed under the ISC licence. See LICENCE for details.

No runtime deps