aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 80c0ddd..25e3d20 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -14,6 +14,8 @@
//! # Example
//!
//! ```rust
+//! # #[cfg(feature = "parse")] {
+//! # #[cfg(feature = "display")] {
//! use toml_edit::{Document, value};
//!
//! let toml = r#"
@@ -32,47 +34,54 @@
//! c = { d = "hello" }
//! "#;
//! assert_eq!(doc.to_string(), expected);
+//! # }
+//! # }
//! ```
//!
//! ## Controlling formatting
//!
//! By default, values are created with default formatting
//! ```rust
+//! # #[cfg(feature = "display")] {
//! let mut doc = toml_edit::Document::new();
//! doc["foo"] = toml_edit::value("bar");
//! let expected = r#"foo = "bar"
//! "#;
//! assert_eq!(doc.to_string(), expected);
+//! # }
//! ```
//!
//! You can choose a custom TOML representation by parsing the value.
//! ```rust
+//! # #[cfg(feature = "display")] {
//! let mut doc = toml_edit::Document::new();
//! doc["foo"] = "'bar'".parse::<toml_edit::Item>().unwrap();
//! let expected = r#"foo = 'bar'
//! "#;
//! assert_eq!(doc.to_string(), expected);
+//! # }
//! ```
//!
//! ## Limitations
//!
//! Things it does not preserve:
//!
-//! * Scattered array of tables (tables are reordered by default, see [test]).
-//! * Order of dotted keys, see [issue](https://github.com/ordian/toml_edit/issues/163).
+//! * Order of dotted keys, see [issue](https://github.com/toml-rs/toml/issues/163).
//!
//! [`toml`]: https://docs.rs/toml/latest/toml/
-//! [test]: https://github.com/ordian/toml_edit/blob/f09bd5d075fdb7d2ef8d9bb3270a34506c276753/tests/test_valid.rs#L84
mod array;
mod array_of_tables;
mod document;
+#[cfg(feature = "display")]
mod encode;
+mod error;
mod index;
mod inline_table;
mod internal_string;
mod item;
mod key;
+#[cfg(feature = "parse")]
mod parser;
mod raw_string;
mod repr;
@@ -92,6 +101,7 @@ pub use crate::array_of_tables::{
ArrayOfTables, ArrayOfTablesIntoIter, ArrayOfTablesIter, ArrayOfTablesIterMut,
};
pub use crate::document::Document;
+pub use crate::error::TomlError;
pub use crate::inline_table::{
InlineEntry, InlineOccupiedEntry, InlineTable, InlineTableIntoIter, InlineTableIter,
InlineTableIterMut, InlineVacantEntry,
@@ -99,7 +109,6 @@ pub use crate::inline_table::{
pub use crate::internal_string::InternalString;
pub use crate::item::{array, table, value, Item};
pub use crate::key::{Key, KeyMut};
-pub use crate::parser::TomlError;
pub use crate::raw_string::RawString;
pub use crate::repr::{Decor, Formatted, Repr};
pub use crate::table::{