calcard
Calcard is a Rust crate for parsing and generating vCard and iCalendar data. It is designed to easily handle .vcf
and .ics
file formats, making it straightforward to integrate with calendaring and contact management applications.
In general, this library abides by the Postel's law or Robustness Principle which states that an implementation must be conservative in its sending behavior and liberal in its receiving behavior. This means that calcard will make a best effort to parse non-conformant iCal/vCard objects as long as these do not deviate too much from the standard.
Usage
Parsing Stream
You can parse vCard and iCalendar files using the stream-based parser:
let input = "BEGIN:VCARD\nVERSION:3.0\nFN:John Doe\nEND:VCARD\n";
let mut parser = new;
loop
Parsing a Single vCard or iCalendar
You can also parse a single vCard or iCalendar instance directly:
let vcard_input = "BEGIN:VCARD\nVERSION:3.0\nFN:John Doe\nEND:VCARD\n";
let vcard = parse;
println!;
let ical_input = "BEGIN:VCALENDAR\nVERSION:2.0\nEND:VCALENDAR\n";
let ical = parse;
println!;
Generation
To generate a vCard or iCalendar, simply call .to_string()
on the parsed object:
let vcard_string = vcard.to_string;
println!;
let ical_string = ical.to_string;
println!;
Note: Documentation for creating VCard and ICalendar objects is coming soon.
Testing and Fuzzing
To run the testsuite:
or, to run the testsuite with MIRI:
To fuzz the library with cargo-fuzz
:
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Funding
Part of the development of this library was funded through the NGI Zero Core, a fund established by NLnet with financial support from the European Commission's programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 101092990.
If you find this library useful you can help by becoming a sponsor. Thank you!
Copyright
Copyright (C) 2020, Stalwart Labs LLC