File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 1
1
//! A low-level interface for writing out TOML
2
2
//!
3
+ //! Considerations when serializing arbitrary data:
4
+ //! - Verify the implementation with [`toml-test-harness`](https://docs.rs/toml-test-harness)
5
+ //! - Be sure to group keys under a table before writing another table
6
+ //! - Watch for extra trailing newlines and leading newlines, both when starting with top-level
7
+ //! keys or a table
8
+ //! - When serializing an array-of-tables, be sure to verify that all elements of the array
9
+ //! serialize as tables
10
+ //! - Standard tables and inline tables may need separate implementations of corner cases,
11
+ //! requiring verifying them both
12
+ //!
13
+ //! When serializing Rust data structures
14
+ //! - `Option`: Skip key-value pairs with a value of `None`, otherwise error when seeing `None`
15
+ //! - When skipping key-value pairs, be careful that a deeply nested `None` doesn't get skipped
16
+ //! - Scalars and arrays are unsupported as top-level data types
17
+ //! - Tuples and tuple variants seriallize as arrays
18
+ //! - Structs, struct variants, and maps serialize as tables
19
+ //! - Newtype variants serialize as to the inner type
20
+ //! - Unit variants serialize to a string
21
+ //! - Unit and unit structs don't have a clear meaning in TOML
22
+ //!
3
23
//! # Example
4
24
//!
5
25
//! ```rust
You can’t perform that action at this time.
0 commit comments