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
//! A low-level interface for writing out TOML
//!
//! Considerations when serializing arbitrary data:
//! - Verify the implementation with [`toml-test-harness`](https://docs.rs/toml-test-harness)
//! - Be sure to group keys under a table before writing another table
//! - Watch for extra trailing newlines and leading newlines, both when starting with top-level
//! keys or a table
//! - When serializing an array-of-tables, be sure to verify that all elements of the array
//! serialize as tables
//! - Standard tables and inline tables may need separate implementations of corner cases,
//! requiring verifying them both
//!
//! When serializing Rust data structures
//! - `Option`: Skip key-value pairs with a value of `None`, otherwise error when seeing `None`
//! - When skipping key-value pairs, be careful that a deeply nested `None` doesn't get skipped
//! - Scalars and arrays are unsupported as top-level data types
//! - Tuples and tuple variants seriallize as arrays
//! - Structs, struct variants, and maps serialize as tables
//! - Newtype variants serialize as to the inner type
//! - Unit variants serialize to a string
//! - Unit and unit structs don't have a clear meaning in TOML
//!
//! # Example
//!
//! ```rust
//! use toml_write::TomlWrite as _;
//!
//! # fn main() -> std::fmt::Result {
//! let mut output = String::new();
//! output.newline()?;
//! output.open_table_header()?;
//! output.key("table")?;
//! output.close_table_header()?;
//! output.newline()?;
//!
//! output.key("key")?;
//! output.space()?;
//! output.keyval_sep()?;
//! output.space()?;
//! output.value("value")?;
//! output.newline()?;
//!
//! assert_eq!(output, r#"
//! [table]
//! key = "value"
//! "#);
//! # Ok(())
//! # }
//! ```
extern crate alloc;
pub use ToTomlKey;
pub use WriteTomlKey;
pub use TomlKey;
pub use TomlKeyBuilder;
pub use TomlString;
pub use TomlStringBuilder;
pub use ToTomlValue;
pub use WriteTomlValue;
pub use TomlWrite;
;