1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//! High-level bindings for the [LibYAML] library.
//!
//! [LibYAML]: https://github.com/yaml/libyaml
//!
//! # Reading YAML
//!
//! To read a YAML stream, use [`Parser`]. This example counts the number of
//! alias events in a stream.
//!
//! ```
//! # use std::io;
//! # use libyaml::*;
//! #
//! # fn doctest<R: io::Read>(reader: R) -> Result<(), ParserError> {
//! let alias_count = Parser::new(reader)?.into_iter().filter(|e| {
//! if let Ok(Event::Alias { .. }) = e { true } else { false }
//! }).count();
//! # Ok(())
//! # }
//! ```
//!
//! [`Parser`]: struct.Parser.html
//!
//! # Writing YAML
//!
//! To write a YAML stream, use [`Emitter`]. This example writes a stream with
//! a single document consisting of a single scalar.
//!
//! ```
//! # use std::io;
//! # use libyaml::*;
//! #
//! # fn doctest<W: io::Write>(writer: W) -> Result<(), EmitterError> {
//! let mut emitter = Emitter::new(writer)?;
//!
//! emitter.emit(Event::StreamStart { encoding: None })?;
//! emitter.emit(Event::DocumentStart { implicit: true })?;
//! emitter.emit(Event::Scalar {
//! anchor: None,
//! tag: Some(tag::INT.to_string()),
//! value: "42".to_string(),
//! plain_implicit: false,
//! quoted_implicit: false,
//! style: None,
//! })?;
//! emitter.emit(Event::DocumentEnd { implicit: true })?;
//! emitter.emit(Event::StreamEnd)?;
//! # Ok(())
//! # }
//! ```
//!
//! [`Emitter`]: struct.Emitter.html
pub use Emitter;
pub use EmitterBuilder;
pub use EmitterError;
pub use Encoding;
pub use Event;
pub use EventError;
pub use LineBreak;
pub use MappingStyle;
pub use Parser;
pub use ParserBuilder;
pub use ParserError;
pub use ParserIter;
pub use ScalarStyle;
pub use SequenceStyle;
pub use TagDirective;
pub use VersionDirective;
use unsafe_libyaml as sys;