Expand description
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);
Modules§
- error
- Errors returned when validating content line data.
Structs§
- Content
Line Writer - Writer which encodes content lines into a iCalendar or vCard files.
- Line
With Name - An incomplete line which only has a name.
- Line
With Param - An incomplete line which has a name and at least one parameter.