docs: update readme

This commit is contained in:
Kat Marchán 2024-12-03 00:26:25 -08:00
parent b874023a69
commit 887a5438d3
No known key found for this signature in database
GPG Key ID: AEB529C08A3C7E9E
2 changed files with 20 additions and 18 deletions

View File

@ -23,9 +23,11 @@ use kdl::KdlDocument;
let doc_str = r#" let doc_str = r#"
hello 1 2 3 hello 1 2 3
world prop="value" { // Comment
world prop=value {
child 1 child 1
child 2 child 2
child #inf
} }
"#; "#;
@ -112,15 +114,14 @@ KDL itself does not specify a particular representation for numbers and
accepts just about anything valid, no matter how large and how small. This accepts just about anything valid, no matter how large and how small. This
means a few things: means a few things:
* Numbers without a decimal point are interpreted as [`u64`]. * Numbers without a decimal point are interpreted as [`i128`].
* Numbers with a decimal point are interpreted as [`f64`]. * Numbers with a decimal point are interpreted as [`f64`].
* Floating point numbers that evaluate to [`f64::INFINITY`] or * The keywords `#inf`, `#-inf`, and `#nan` evaluate to [`f64::INFINITY`],
[`f64::NEG_INFINITY`] or NaN will be represented as such in the values, [`f64::NEG_INFINITY`], and [`f64::NAN`].
instead of the original numbers. * The original _representation/text_ of these numbers will be preserved,
* A similar restriction applies to overflowed [`u64`] values. unless you [`KdlDocument::autoformat`] in which case the original
* The original _representation_ of these numbers will be preserved, unless representation will be thrown away and the actual value will be used when
you [`KdlDocument::fmt`] in which case the original representation will be serializing.
thrown away and the actual value will be used when serializing.
### Minimum Supported Rust Version ### Minimum Supported Rust Version

View File

@ -21,9 +21,11 @@
//! let doc_str = r#" //! let doc_str = r#"
//! hello 1 2 3 //! hello 1 2 3
//! //!
//! world prop="value" { //! // Comment
//! world prop=value {
//! child 1 //! child 1
//! child 2 //! child 2
//! child #inf
//! } //! }
//! "#; //! "#;
//! //!
@ -110,15 +112,14 @@
//! accepts just about anything valid, no matter how large and how small. This //! accepts just about anything valid, no matter how large and how small. This
//! means a few things: //! means a few things:
//! //!
//! * Numbers without a decimal point are interpreted as [`u64`]. //! * Numbers without a decimal point are interpreted as [`i128`].
//! * Numbers with a decimal point are interpreted as [`f64`]. //! * Numbers with a decimal point are interpreted as [`f64`].
//! * Floating point numbers that evaluate to [`f64::INFINITY`] or //! * The keywords `#inf`, `#-inf`, and `#nan` evaluate to [`f64::INFINITY`],
//! [`f64::NEG_INFINITY`] or NaN will be represented as such in the values, //! [`f64::NEG_INFINITY`], and [`f64::NAN`].
//! instead of the original numbers. //! * The original _representation/text_ of these numbers will be preserved,
//! * A similar restriction applies to overflowed [`u64`] values. //! unless you [`KdlDocument::autoformat`] in which case the original
//! * The original _representation_ of these numbers will be preserved, unless //! representation will be thrown away and the actual value will be used when
//! you [`KdlDocument::fmt`] in which case the original representation will be //! serializing.
//! thrown away and the actual value will be used when serializing.
//! //!
//! ## Minimum Supported Rust Version //! ## Minimum Supported Rust Version
//! //!