Files
aho_corasick
atty
beef
bitflags
bstr
byteorder
cfg_if
clap
clap_derive
codespan
codespan_reporting
crc_any
crypto_hash
csv
csv_core
debug_helper
filepath
fixed
fixed_macro
fixed_macro_impl
fixed_macro_types
fnv
foreign_types
foreign_types_shared
getrandom
glob
hashbrown
heck
hex
indexmap
itoa
lazy_static
libc
linked_hash_map
linked_hash_set
logos
logos_derive
lrl_test_compiler
maplit
memchr
memoffset
once_cell
openssl
openssl_sys
os_str_bytes
paste
pest
pest_derive
pest_generator
pest_meta
phf
phf_generator
phf_macros
phf_shared
ppv_lite86
proc_macro2
proc_macro_error
proc_macro_error_attr
proc_macro_hack
quote
rand
rand_chacha
rand_core
regex
regex_automata
regex_syntax
remove_dir_all
ring
rowan
rustc_hash
ryu
semver
semver_parser
serde
serde_derive
serde_json
siphasher
smallvec
smawk
smol_str
spin
stable_deref_trait
strsim
syn
taplo
tempfile
termcolor
text_size
textwrap
toml
triomphe
typenum
ucd_trie
unicode_linebreak
unicode_segmentation
unicode_width
unicode_xid
untrusted
utf8_ranges
vec_map
 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
93
94
#![allow(clippy::single_match)]
/*!

# About

The main purpose of the library is to provide tools for analyzing TOML data where the
layout must be preserved and the original position of every parsed token must be known. It can
also format TOML documents.

It uses [Rowan](::rowan) for the syntax tree, and every character is preserved from the input,
including all comments and white space.

A [DOM](dom) can be constructed for data-oriented analysis where each node wraps a part of the
syntax tree with additional information and functionality.

Taplo also exposes a [Value](value::Value) type that can be created from [DOM](dom) nodes
and can be serialized with [Serde](serde) allowing for conversion to JSON, YAML or any other format.

TOML serialization is currently not implemented, but it is planned with a low priority.

# Features

- **chrono**: Use [chrono](https://github.com/chronotope/chrono) for TOML dates and times
- **time**: Use [time](https://github.com/time-rs/time) for TOML dates and times

`chrono` and `time` are mutually exclusive, if neither is set dates will be treated as strings.

- **serde**: Support for [serde](https://serde.rs)
- **schema**: Enable schema-related utilities and built-in schemas.
- **rewrite**: Enable DOM manipulation features (**WIP!**)

# Usage

A TOML document has to be parsed with [parse](parser::parse) first, it
will build a syntax tree that can be traversed.

If there were no syntax errors during parsing, then a [DOM root node](dom::RootNode)
can be constructed. It will build a DOM tree and validate the TOML document according
to the specification. A DOM tree can be constructed even with syntax errors present, however
parts of it will be missing.

If any errors ocurred, they will be collected in the root node. In that case
the DOM must be analyzed with caution as parts of it might be missing.

```edition2018
# use taplo::parser::parse;
const SOURCE: &str =
"value = 1
value = 2

[table]
string = 'some string'";

let parse_result = parse(SOURCE);

// Check for syntax errors.
// These are not carried over to DOM errors.
assert!(parse_result.errors.is_empty());

let root_node = parse_result.into_dom();

// Check for semantic errors.
// In this example "value" is a duplicate key.
assert_eq!(root_node.errors().len(), 1);
```
*/

#[cfg(feature = "serde")]
mod serde;

#[cfg(feature = "verify")]
pub mod verify;

#[cfg(feature = "schema")]
pub mod schema;

pub mod analytics;
pub mod dom;
pub mod formatter;
pub mod parser;
pub mod syntax;
pub mod util;
pub mod value;

pub use rowan;

#[cfg(test)]
mod tests;

#[cfg(target_arch = "wasm32")]
pub mod wasm;

#[cfg(all(feature = "chrono", feature = "time"))]
compile_error!(r#"the "chrono" and "time" features cannot be used at the same time"#);