diff options
author | Melody Horn <melody@boringcactus.com> | 2021-03-21 14:10:24 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-03-21 14:10:24 -0600 |
commit | 7bbbfd046324363c8db1fb15d39aeb02fe7331b5 (patch) | |
tree | a416bb991c23e083d0b5816dfc8b00cd1aceda78 | |
parent | b1417006df376e6c406bff43740dd11aa7ef744e (diff) | |
download | milf-rs-main.tar.gz milf-rs-main.zip |
-rw-r--r-- | Cargo.toml | 17 | ||||
-rw-r--r-- | README.md | 22 | ||||
-rw-r--r-- | examples/decode.rs | 8 | ||||
-rw-r--r-- | examples/enum_external.rs | 6 | ||||
-rw-r--r-- | examples/toml2json.rs | 26 | ||||
-rw-r--r-- | src/datetime.rs | 16 | ||||
-rw-r--r-- | src/de.rs | 38 | ||||
-rw-r--r-- | src/lib.rs | 34 | ||||
-rw-r--r-- | src/macros.rs | 166 | ||||
-rw-r--r-- | src/map.rs | 16 | ||||
-rw-r--r-- | src/ser.rs | 38 | ||||
-rw-r--r-- | src/spanned.rs | 14 | ||||
-rw-r--r-- | src/value.rs | 44 | ||||
-rw-r--r-- | test-suite/Cargo.toml | 4 | ||||
-rw-r--r-- | test-suite/benches/linear.rs | 2 | ||||
-rw-r--r-- | test-suite/tests/backcompat.rs | 14 | ||||
-rw-r--r-- | test-suite/tests/datetime.rs | 14 | ||||
-rw-r--r-- | test-suite/tests/de-errors.rs | 12 | ||||
-rw-r--r-- | test-suite/tests/display-tricky.rs | 12 | ||||
-rw-r--r-- | test-suite/tests/display.rs | 6 | ||||
-rw-r--r-- | test-suite/tests/float.rs | 10 | ||||
-rw-r--r-- | test-suite/tests/formatting.rs | 4 | ||||
-rw-r--r-- | test-suite/tests/invalid-misc.rs | 6 | ||||
-rw-r--r-- | test-suite/tests/invalid.rs | 94 | ||||
-rw-r--r-- | test-suite/tests/invalid/datetime-malformed-no-leads.milf (renamed from test-suite/tests/invalid/datetime-malformed-no-leads.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/datetime-malformed-no-secs.milf (renamed from test-suite/tests/invalid/datetime-malformed-no-secs.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/datetime-malformed-no-t.milf (renamed from test-suite/tests/invalid/datetime-malformed-no-t.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/datetime-malformed-with-milli.milf (renamed from test-suite/tests/invalid/datetime-malformed-with-milli.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/duplicate-key-table.milf (renamed from test-suite/tests/invalid/duplicate-key-table.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/duplicate-keys.milf (renamed from test-suite/tests/invalid/duplicate-keys.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/duplicate-table.milf (renamed from test-suite/tests/invalid/duplicate-table.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/duplicate-tables.milf (renamed from test-suite/tests/invalid/duplicate-tables.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/empty-implicit-table.milf (renamed from test-suite/tests/invalid/empty-implicit-table.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/empty-table.milf (renamed from test-suite/tests/invalid/empty-table.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/float-no-leading-zero.milf (renamed from test-suite/tests/invalid/float-no-leading-zero.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/float-no-suffix.milf (renamed from test-suite/tests/invalid/float-no-suffix.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/float-no-trailing-digits.milf (renamed from test-suite/tests/invalid/float-no-trailing-digits.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/key-after-array.milf (renamed from test-suite/tests/invalid/key-after-array.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/key-after-table.milf (renamed from test-suite/tests/invalid/key-after-table.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/key-empty.milf (renamed from test-suite/tests/invalid/key-empty.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/key-hash.milf (renamed from test-suite/tests/invalid/key-hash.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/key-newline.milf (renamed from test-suite/tests/invalid/key-newline.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/key-open-bracket.milf (renamed from test-suite/tests/invalid/key-open-bracket.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/key-single-open-bracket.milf (renamed from test-suite/tests/invalid/key-single-open-bracket.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/key-space.milf (renamed from test-suite/tests/invalid/key-space.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/key-start-bracket.milf (renamed from test-suite/tests/invalid/key-start-bracket.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/key-two-equals.milf (renamed from test-suite/tests/invalid/key-two-equals.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/string-bad-byte-escape.milf (renamed from test-suite/tests/invalid/string-bad-byte-escape.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/string-bad-escape.milf (renamed from test-suite/tests/invalid/string-bad-escape.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/string-bad-line-ending-escape.milf (renamed from test-suite/tests/invalid/string-bad-line-ending-escape.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/string-byte-escapes.milf (renamed from test-suite/tests/invalid/string-byte-escapes.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/string-no-close.milf (renamed from test-suite/tests/invalid/string-no-close.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/table-array-implicit.milf (renamed from test-suite/tests/invalid/table-array-implicit.toml) | 2 | ||||
-rw-r--r-- | test-suite/tests/invalid/table-array-malformed-bracket.milf (renamed from test-suite/tests/invalid/table-array-malformed-bracket.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/table-array-malformed-empty.milf (renamed from test-suite/tests/invalid/table-array-malformed-empty.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/table-empty.milf (renamed from test-suite/tests/invalid/table-empty.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/table-nested-brackets-close.milf (renamed from test-suite/tests/invalid/table-nested-brackets-close.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/table-nested-brackets-open.milf (renamed from test-suite/tests/invalid/table-nested-brackets-open.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/table-whitespace.milf (renamed from test-suite/tests/invalid/table-whitespace.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/table-with-pound.milf (renamed from test-suite/tests/invalid/table-with-pound.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/text-after-array-entries.milf (renamed from test-suite/tests/invalid/text-after-array-entries.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/text-after-integer.milf (renamed from test-suite/tests/invalid/text-after-integer.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/text-after-string.milf (renamed from test-suite/tests/invalid/text-after-string.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/text-after-table.milf (renamed from test-suite/tests/invalid/text-after-table.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/text-before-array-separator.milf (renamed from test-suite/tests/invalid/text-before-array-separator.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/invalid/text-in-array.milf (renamed from test-suite/tests/invalid/text-in-array.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/macros.rs | 38 | ||||
-rw-r--r-- | test-suite/tests/parser.rs | 22 | ||||
-rw-r--r-- | test-suite/tests/pretty.rs | 104 | ||||
-rw-r--r-- | test-suite/tests/serde.rs | 64 | ||||
-rw-r--r-- | test-suite/tests/spanned-impls.rs | 2 | ||||
-rw-r--r-- | test-suite/tests/spanned.rs | 22 | ||||
-rw-r--r-- | test-suite/tests/tables-last.rs | 6 | ||||
-rw-r--r-- | test-suite/tests/valid.rs | 196 | ||||
-rw-r--r-- | test-suite/tests/valid/array-empty.milf (renamed from test-suite/tests/valid/array-empty.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/array-mixed-types-arrays-and-ints.milf (renamed from test-suite/tests/valid/array-mixed-types-arrays-and-ints.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/array-mixed-types-ints-and-floats.milf (renamed from test-suite/tests/valid/array-mixed-types-ints-and-floats.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/array-mixed-types-strings-and-ints.milf (renamed from test-suite/tests/valid/array-mixed-types-strings-and-ints.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/array-nospaces.milf (renamed from test-suite/tests/valid/array-nospaces.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/arrays-hetergeneous.milf (renamed from test-suite/tests/valid/arrays-hetergeneous.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/arrays-nested.milf (renamed from test-suite/tests/valid/arrays-nested.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/arrays.milf (renamed from test-suite/tests/valid/arrays.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/bool.milf (renamed from test-suite/tests/valid/bool.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/comments-everywhere.milf (renamed from test-suite/tests/valid/comments-everywhere.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/datetime-truncate.milf (renamed from test-suite/tests/valid/datetime-truncate.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/datetime.milf (renamed from test-suite/tests/valid/datetime.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/dotted-keys.milf (renamed from test-suite/tests/valid/dotted-keys.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/empty.milf (renamed from test-suite/tests/valid/empty.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/example-bom.milf (renamed from test-suite/tests/valid/example-bom.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/example-v0.3.0.milf (renamed from test-suite/tests/valid/example-v0.3.0.toml) | 2 | ||||
-rw-r--r-- | test-suite/tests/valid/example-v0.4.0.milf (renamed from test-suite/tests/valid/example-v0.4.0.toml) | 2 | ||||
-rw-r--r-- | test-suite/tests/valid/example.milf (renamed from test-suite/tests/valid/example.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/example2.json | 2 | ||||
-rw-r--r-- | test-suite/tests/valid/example2.milf (renamed from test-suite/tests/valid/example2.toml) | 6 | ||||
-rw-r--r-- | test-suite/tests/valid/float-exponent.milf (renamed from test-suite/tests/valid/float-exponent.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/float.milf (renamed from test-suite/tests/valid/float.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/hard_example.milf (renamed from test-suite/tests/valid/hard_example.toml) | 4 | ||||
-rw-r--r-- | test-suite/tests/valid/implicit-and-explicit-after.milf (renamed from test-suite/tests/valid/implicit-and-explicit-after.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/implicit-and-explicit-before.milf (renamed from test-suite/tests/valid/implicit-and-explicit-before.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/implicit-groups.milf (renamed from test-suite/tests/valid/implicit-groups.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/integer.milf (renamed from test-suite/tests/valid/integer.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/key-equals-nospace.milf (renamed from test-suite/tests/valid/key-equals-nospace.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/key-quote-newline.milf (renamed from test-suite/tests/valid/key-quote-newline.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/key-space.milf (renamed from test-suite/tests/valid/key-space.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/key-special-chars.milf (renamed from test-suite/tests/valid/key-special-chars.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/key-with-pound.milf (renamed from test-suite/tests/valid/key-with-pound.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/long-float.milf (renamed from test-suite/tests/valid/long-float.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/long-integer.milf (renamed from test-suite/tests/valid/long-integer.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/multiline-string.milf (renamed from test-suite/tests/valid/multiline-string.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/quote-surrounded-value.milf (renamed from test-suite/tests/valid/quote-surrounded-value.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/raw-multiline-string.milf (renamed from test-suite/tests/valid/raw-multiline-string.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/raw-string.milf (renamed from test-suite/tests/valid/raw-string.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/string-delim-end.milf (renamed from test-suite/tests/valid/string-delim-end.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/string-empty.milf (renamed from test-suite/tests/valid/string-empty.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/string-escapes.milf (renamed from test-suite/tests/valid/string-escapes.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/string-simple.milf (renamed from test-suite/tests/valid/string-simple.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/string-with-pound.milf (renamed from test-suite/tests/valid/string-with-pound.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/table-array-implicit.milf (renamed from test-suite/tests/valid/table-array-implicit.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/table-array-many.milf (renamed from test-suite/tests/valid/table-array-many.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/table-array-nest-no-keys.milf (renamed from test-suite/tests/valid/table-array-nest-no-keys.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/table-array-nest.milf (renamed from test-suite/tests/valid/table-array-nest.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/table-array-one.milf (renamed from test-suite/tests/valid/table-array-one.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/table-empty.milf (renamed from test-suite/tests/valid/table-empty.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/table-multi-empty.milf (renamed from test-suite/tests/valid/table-multi-empty.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/table-sub-empty.milf (renamed from test-suite/tests/valid/table-sub-empty.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/table-whitespace.milf (renamed from test-suite/tests/valid/table-whitespace.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/table-with-pound.milf (renamed from test-suite/tests/valid/table-with-pound.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/unicode-escape.milf (renamed from test-suite/tests/valid/unicode-escape.toml) | 0 | ||||
-rw-r--r-- | test-suite/tests/valid/unicode-literal.milf (renamed from test-suite/tests/valid/unicode-literal.toml) | 0 | ||||
-rw-r--r-- | tests/enum_external_deserialize.rs | 48 |
130 files changed, 570 insertions, 573 deletions
@@ -1,16 +1,15 @@ [package] -name = "toml" +name = "milf" version = "0.5.8" -authors = ["Alex Crichton <alex@alexcrichton.com>"] +authors = ["boringcactus <melody@boringcactus.com>"] license = "MIT/Apache-2.0" readme = "README.md" keywords = ["encoding"] -repository = "https://github.com/alexcrichton/toml-rs" -homepage = "https://github.com/alexcrichton/toml-rs" -documentation = "https://docs.rs/toml" +repository = "https://code.boringcactus.com/misc/milf-rs/" +documentation = "https://docs.rs/milf" description = """ -A native Rust encoder and decoder of TOML-formatted files and streams. Provides -implementations of the standard Serialize/Deserialize traits for TOML data to +A native Rust encoder and decoder of My INI-Like Format (MILF)-formatted files and streams. Provides +implementations of the standard Serialize/Deserialize traits for MILF data to facilitate deserializing and serializing Rust structures. """ categories = ["config", "encoding", "parser-implementations"] @@ -30,7 +29,7 @@ serde_json = "1.0" [features] default = [] -# Use indexmap rather than BTreeMap as the map type of toml::Value. -# This allows data to be read into a Value and written back to a TOML string +# Use indexmap rather than BTreeMap as the map type of milf::Value. +# This allows data to be read into a Value and written back to a MILF string # while preserving the order of map keys in the input. preserve_order = ["indexmap"] @@ -1,23 +1,23 @@ -# toml-rs +# milf-rs -[![Latest Version](https://img.shields.io/crates/v/toml.svg)](https://crates.io/crates/toml) -[![Documentation](https://docs.rs/toml/badge.svg)](https://docs.rs/toml) +[![Latest Version](https://img.shields.io/crates/v/milf.svg)](https://crates.io/crates/milf) +[![Documentation](https://docs.rs/milf/badge.svg)](https://docs.rs/milf) -A [TOML][toml] decoder and encoder for Rust. This library is currently compliant -with the v0.5.0 version of TOML. This library will also likely continue to stay -up to date with the TOML specification as changes happen. +A [My INI-Like Format (MILF)][toml] decoder and encoder for Rust. This library is currently compliant +with the v0.5.0 version of MILF. This library will also likely continue to stay +up to date with the MILF specification as changes happen. [toml]: https://github.com/toml-lang/toml ```toml -# Cargo.toml +# Cargo.milf [dependencies] -toml = "0.5" +milf = "0.5" ``` This crate also supports serialization/deserialization through the [serde](https://serde.rs) crate on crates.io. Currently the older `rustc-serialize` -crate is not supported in the 0.3+ series of the `toml` crate, but 0.2 can be +crate is not supported in the 0.3+ series of the `milf` crate, but 0.2 can be used for that support. # License @@ -33,6 +33,4 @@ at your option. ### Contribution -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in toml-rs by you, as defined in the Apache-2.0 license, shall be -dual licensed as above, without any additional terms or conditions. +Don't contribute to this. diff --git a/examples/decode.rs b/examples/decode.rs index b5d6a99..63fb315 100644 --- a/examples/decode.rs +++ b/examples/decode.rs @@ -1,12 +1,12 @@ //! An example showing off the usage of `Deserialize` to automatically decode -//! TOML into a Rust `struct` +//! MILF into a Rust `struct` #![deny(warnings)] use serde_derive::Deserialize; /// This is what we're going to decode into. Each field is optional, meaning -/// that it doesn't have to be present in TOML. +/// that it doesn't have to be present in MILF. #[derive(Debug, Deserialize)] struct Config { global_string: Option<String>, @@ -32,7 +32,7 @@ struct PeerConfig { } fn main() { - let toml_str = r#" + let milf_str = r#" global_string = "test" global_integer = 5 @@ -48,6 +48,6 @@ fn main() { ip = "127.0.0.1" "#; - let decoded: Config = toml::from_str(toml_str).unwrap(); + let decoded: Config = milf::from_str(milf_str).unwrap(); println!("{:#?}", decoded); } diff --git a/examples/enum_external.rs b/examples/enum_external.rs index a7dd84a..4cddabb 100644 --- a/examples/enum_external.rs +++ b/examples/enum_external.rs @@ -1,5 +1,5 @@ //! An example showing off the usage of `Deserialize` to automatically decode -//! TOML into a Rust `struct`, with enums. +//! MILF into a Rust `struct`, with enums. #![deny(warnings)] @@ -26,7 +26,7 @@ enum MyEnum { } fn main() { - let toml_str = r#" + let milf_str = r#" plain = "Plain" plain_table = { Plain = {} } tuple = { Tuple = { 0 = 123, 1 = true } } @@ -39,6 +39,6 @@ fn main() { { Struct = { value = 123 } } ]"#; - let decoded: Config = toml::from_str(toml_str).unwrap(); + let decoded: Config = milf::from_str(milf_str).unwrap(); println!("{:#?}", decoded); } diff --git a/examples/toml2json.rs b/examples/toml2json.rs index 1b90c9f..6e02e8b 100644 --- a/examples/toml2json.rs +++ b/examples/toml2json.rs @@ -6,7 +6,7 @@ use std::io; use std::io::prelude::*; use serde_json::Value as Json; -use toml::Value as Toml; +use milf::Value as Milf; fn main() { let mut args = env::args(); @@ -21,27 +21,27 @@ fn main() { } match input.parse() { - Ok(toml) => { - let json = convert(toml); + Ok(milf) => { + let json = convert(milf); println!("{}", serde_json::to_string_pretty(&json).unwrap()); } - Err(error) => println!("failed to parse TOML: {}", error), + Err(error) => println!("failed to parse MILF: {}", error), } } -fn convert(toml: Toml) -> Json { - match toml { - Toml::String(s) => Json::String(s), - Toml::Integer(i) => Json::Number(i.into()), - Toml::Float(f) => { +fn convert(milf: Milf) -> Json { + match milf { + Milf::String(s) => Json::String(s), + Milf::Integer(i) => Json::Number(i.into()), + Milf::Float(f) => { let n = serde_json::Number::from_f64(f).expect("float infinite and nan not allowed"); Json::Number(n) } - Toml::Boolean(b) => Json::Bool(b), - Toml::Array(arr) => Json::Array(arr.into_iter().map(convert).collect()), - Toml::Table(table) => { + Milf::Boolean(b) => Json::Bool(b), + Milf::Array(arr) => Json::Array(arr.into_iter().map(convert).collect()), + Milf::Table(table) => { Json::Object(table.into_iter().map(|(k, v)| (k, convert(v))).collect()) } - Toml::Datetime(dt) => Json::String(dt.to_string()), + Milf::Datetime(dt) => Json::String(dt.to_string()), } } diff --git a/src/datetime.rs b/src/datetime.rs index 1f68bfd..2445c48 100644 --- a/src/datetime.rs +++ b/src/datetime.rs @@ -4,22 +4,22 @@ use std::str::{self, FromStr}; use serde::{de, ser}; -/// A parsed TOML datetime value +/// A parsed MILF datetime value /// /// This structure is intended to represent the datetime primitive type that can -/// be encoded into TOML documents. This type is a parsed version that contains +/// be encoded into MILF documents. This type is a parsed version that contains /// all metadata internally. /// /// Currently this type is intentionally conservative and only supports /// `to_string` as an accessor. Over time though it's intended that it'll grow /// more support! /// -/// Note that if you're using `Deserialize` to deserialize a TOML document, you +/// Note that if you're using `Deserialize` to deserialize a MILF document, you /// can use this as a placeholder for where you're expecting a datetime to be /// specified. /// /// Also note though that while this type implements `Serialize` and -/// `Deserialize` it's only recommended to use this type with the TOML format, +/// `Deserialize` it's only recommended to use this type with the MILF format, /// otherwise encoded in other formats it may look a little odd. #[derive(PartialEq, Clone)] pub struct Datetime { @@ -38,10 +38,10 @@ pub struct DatetimeParseError { // to a special valid in the serde data model. Namely one with these special // fields/struct names. // -// In general the TOML encoder/decoder will catch this and not literally emit +// In general the MILF encoder/decoder will catch this and not literally emit // these strings but rather emit datetimes as they're intended. -pub const FIELD: &str = "$__toml_private_datetime"; -pub const NAME: &str = "$__toml_private_Datetime"; +pub const FIELD: &str = "$__milf_private_datetime"; +pub const NAME: &str = "$__milf_private_Datetime"; #[derive(PartialEq, Clone)] struct Date { @@ -329,7 +329,7 @@ impl<'de> de::Deserialize<'de> for Datetime { type Value = Datetime; fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { - formatter.write_str("a TOML datetime") + formatter.write_str("a MILF datetime") } fn visit_map<V>(self, mut visitor: V) -> Result<Datetime, V::Error> @@ -1,6 +1,6 @@ -//! Deserializing TOML into Rust structures. +//! Deserializing MILF into Rust structures. //! -//! This module contains all the Serde support for deserializing TOML documents +//! This module contains all the Serde support for deserializing MILF documents //! into Rust structures. Note that some top-level functions here are also //! provided at the top of the crate. @@ -22,13 +22,13 @@ use crate::datetime; use crate::spanned; use crate::tokens::{Error as TokenError, Span, Token, Tokenizer}; -/// Type Alias for a TOML Table pair +/// Type Alias for a MILF Table pair type TablePair<'a> = ((Span, Cow<'a, str>), Value<'a>); /// Deserializes a byte slice into a type. /// /// This function will attempt to interpret `bytes` as UTF-8 data and then -/// deserialize `T` from the TOML document provided. +/// deserialize `T` from the MILF document provided. pub fn from_slice<'de, T>(bytes: &'de [u8]) -> Result<T, Error> where T: de::Deserialize<'de>, @@ -41,7 +41,7 @@ where /// Deserializes a string into a type. /// -/// This function will attempt to interpret `s` as a TOML document and +/// This function will attempt to interpret `s` as a MILF document and /// deserialize `T` from the document. /// /// # Examples @@ -61,14 +61,14 @@ where /// } /// /// fn main() { -/// let config: Config = toml::from_str(r#" -/// title = 'TOML Example' +/// let config: Config = milf::from_str(r#" +/// title = 'MILF Example' /// /// [owner] /// name = 'Lisa' /// "#).unwrap(); /// -/// assert_eq!(config.title, "TOML Example"); +/// assert_eq!(config.title, "MILF Example"); /// assert_eq!(config.owner.name, "Lisa"); /// } /// ``` @@ -198,7 +198,7 @@ enum ErrorKind { __Nonexhaustive, } -/// Deserialization implementation for TOML. +/// Deserialization implementation for MILF. pub struct Deserializer<'a> { require_newline_after_table: bool, allow_duplciate_after_longer_table: bool, @@ -231,7 +231,7 @@ impl<'de, 'b> de::Deserializer<'de> for &'b mut Deserializer<'de> { de: self, }); res.map_err(|mut err| { - // Errors originating from this library (toml), have an offset + // Errors originating from this library (milf), have an offset // attached to them already. Other errors, like those originating // from serde (like "missing field") or from a custom deserializer, // do not have offsets on them. Here, we do a best guess at their @@ -444,7 +444,7 @@ impl<'de, 'b> de::MapAccess<'de> for MapVisitor<'de, 'b> { self.cur = pos; // Test to see if we're duplicating our parent's table, and if so - // then this is an error in the toml format + // then this is an error in the milf format if self.cur_parent != pos { if headers_equal( &self.tables[self.cur_parent].header, @@ -647,7 +647,7 @@ impl<'de, 'b> de::Deserializer<'de> for MapVisitor<'de, 'b> { && !(self.array && !self.values.peek().is_none()) { // TODO we can't actually emit spans here for the *entire* table/array - // due to the format that toml uses. Setting the start and end to 0 is + // due to the format that milf uses. Setting the start and end to 0 is // *detectable* (and no reasonable span would look like that), // it would be better to expose this in the API via proper // ADTs like Option<T>. @@ -1283,22 +1283,22 @@ impl<'a> Deserializer<'a> { Ok(()) } - /// Historical versions of toml-rs accidentally allowed a newline after a - /// table definition, but the TOML spec requires a newline after a table + /// Historical versions of milf-rs accidentally allowed a newline after a + /// table definition, but the MILF spec requires a newline after a table /// definition header. /// /// This option can be set to `false` (the default is `true`) to emulate - /// this behavior for backwards compatibility with older toml-rs versions. + /// this behavior for backwards compatibility with older milf-rs versions. pub fn set_require_newline_after_table(&mut self, require: bool) { self.require_newline_after_table = require; } - /// Historical versions of toml-rs accidentally allowed a duplicate table + /// Historical versions of milf-rs accidentally allowed a duplicate table /// header after a longer table header was previously defined. This is - /// invalid according to the TOML spec, however. + /// invalid according to the MILF spec, however. /// /// This option can be set to `true` (the default is `false`) to emulate - /// this behavior for backwards compatibility with older toml-rs versions. + /// this behavior for backwards compatibility with older milf-rs versions. pub fn set_allow_duplicate_after_longer_table(&mut self, allow: bool) { self.allow_duplciate_after_longer_table = allow; } @@ -2148,7 +2148,7 @@ impl fmt::Display for Error { )?, ErrorKind::UnquotedString => write!( f, - "invalid TOML value, did you mean to use a quoted string?" + "invalid MILF value, did you mean to use a quoted string?" )?, ErrorKind::__Nonexhaustive => panic!(), } @@ -1,14 +1,14 @@ -//! A [TOML]-parsing library +//! A [My INI-Like Format (MILF)]-parsing library //! -//! This library implements a [TOML] v0.5.0 compatible parser, +//! This library implements a [MILF] v0.5.0 compatible parser, //! primarily supporting the [`serde`] library for encoding/decoding //! various types in Rust. //! -//! TOML itself is a simple, ergonomic, and readable configuration format: +//! MILF itself is a simple, ergonomic, and readable configuration format: //! //! ```toml //! [package] -//! name = "toml" +//! name = "milf" //! version = "0.4.2" //! authors = ["Alex Crichton <alex@alexcrichton.com>"] //! @@ -16,12 +16,12 @@ //! serde = "1.0" //! ``` //! -//! The TOML format tends to be relatively common throughout the Rust community +//! The MILF format tends to be relatively common throughout the Rust community //! for configuration, notably being used by [Cargo], Rust's package manager. //! -//! ## TOML values +//! ## MILF values //! -//! A value in TOML is represented with the [`Value`] enum in this crate: +//! A value in MILF is represented with the [`Value`] enum in this crate: //! //! ```rust,ignore //! pub enum Value { @@ -35,16 +35,16 @@ //! } //! ``` //! -//! TOML is similar to JSON with the notable addition of a [`Datetime`] -//! type. In general, TOML and JSON are interchangeable in terms of +//! MILF is similar to JSON with the notable addition of a [`Datetime`] +//! type. In general, MILF and JSON are interchangeable in terms of //! formats. //! -//! ## Parsing TOML +//! ## Parsing MILF //! -//! The easiest way to parse a TOML document is via the [`Value`] type: +//! The easiest way to parse a MILF document is via the [`Value`] type: //! //! ```rust -//! use toml::Value; +//! use milf::Value; //! //! let value = "foo = 'bar'".parse::<Value>().unwrap(); //! @@ -74,7 +74,7 @@ //! use the [`Deserializer`], [`Serializer`], or [`Value`] type itself to act as //! a deserializer/serializer for arbitrary types. //! -//! An example of deserializing with TOML is: +//! An example of deserializing with MILF is: //! //! ```rust //! use serde_derive::Deserialize; @@ -93,7 +93,7 @@ //! } //! //! fn main() { -//! let config: Config = toml::from_str(r#" +//! let config: Config = milf::from_str(r#" //! ip = '127.0.0.1' //! //! [keys] @@ -136,15 +136,15 @@ //! }, //! }; //! -//! let toml = toml::to_string(&config).unwrap(); +//! let milf = milf::to_string(&config).unwrap(); //! } //! ``` //! -//! [TOML]: https://github.com/toml-lang/toml +//! [MILF]: https://github.com/toml-lang/toml //! [Cargo]: https://crates.io/ //! [`serde`]: https://serde.rs/ -#![doc(html_root_url = "https://docs.rs/toml/0.5")] +#![doc(html_root_url = "https://docs.rs/milf/0.5")] #![deny(missing_docs)] #![warn(rust_2018_idioms)] // Makes rustc abort compilation if there are any unsafe blocks in the crate. diff --git a/src/macros.rs b/src/macros.rs index 0731afe..ed719ae 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -2,15 +2,15 @@ pub use serde::de::{Deserialize, IntoDeserializer}; use crate::value::{Array, Table, Value}; -/// Construct a [`toml::Value`] from TOML syntax. +/// Construct a [`milf::Value`] from MILF syntax. /// -/// [`toml::Value`]: value/enum.Value.html +/// [`milf::Value`]: value/enum.Value.html /// /// ```rust /// fn main() { -/// let cargo_toml = toml::toml! { +/// let cargo_milf = milf::milf! { /// [package] -/// name = "toml" +/// name = "milf" /// version = "0.4.5" /// authors = ["Alex Crichton <alex@alexcrichton.com>"] /// @@ -25,20 +25,20 @@ use crate::value::{Array, Table, Value}; /// serde_json = "1.0" /// }; /// -/// println!("{:#?}", cargo_toml); +/// println!("{:#?}", cargo_milf); /// } /// ``` #[macro_export] -macro_rules! toml { - ($($toml:tt)+) => {{ +macro_rules! milf { + ($($milf:tt)+) => {{ let table = $crate::value::Table::new(); let mut root = $crate::Value::Table(table); - $crate::toml_internal!(@toplevel root [] $($toml)+); + $crate::milf_internal!(@toplevel root [] $($milf)+); root }}; } -// TT-muncher to parse TOML syntax into a toml::Value. +// TT-muncher to parse MILF syntax into a milf::Value. // // @toplevel -- Parse tokens outside of an inline table or inline array. In // this state, `[table headers]` and `[[array headers]]` are @@ -55,13 +55,13 @@ macro_rules! toml { // primitive or inline table or inline array. // // @table -- Parse the contents of an inline table, returning them as a -// toml::Value::Table. +// milf::Value::Table. // // @tabledatetime -- Helper to parse a Datetime from string and insert it // into a table, continuing in the @table state. // // @array -- Parse the contents of an inline array, returning them as a -// toml::Value::Array. +// milf::Value::Array. // // @arraydatetime -- Helper to parse a Datetime from string and push it into // an array, continuing in the @array state. @@ -72,105 +72,105 @@ macro_rules! toml { // #[macro_export] #[doc(hidden)] -macro_rules! toml_internal { +macro_rules! milf_internal { // Base case, no elements remaining. (@toplevel $root:ident [$($path:tt)*]) => {}; // Parse negative number `key = -value`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = - $v:tt $($rest:tt)*) => { - $crate::toml_internal!(@toplevel $root [$($path)*] $($($k)-+).+ = (-$v) $($rest)*); + $crate::milf_internal!(@toplevel $root [$($path)*] $($($k)-+).+ = (-$v) $($rest)*); }; // Parse positive number `key = +value`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = + $v:tt $($rest:tt)*) => { - $crate::toml_internal!(@toplevel $root [$($path)*] $($($k)-+).+ = ($v) $($rest)*); + $crate::milf_internal!(@toplevel $root [$($path)*] $($($k)-+).+ = ($v) $($rest)*); }; // Parse offset datetime `key = 1979-05-27T00:32:00.999999-07:00`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt . $frac:tt - $tzh:tt : $tzm:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); }; // Space instead of T. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt . $frac:tt - $tzh:tt : $tzm:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); }; // Parse offset datetime `key = 1979-05-27T00:32:00-07:00`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt - $tzh:tt : $tzm:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec - $tzh : $tzm) $($rest)*); }; // Space instead of T. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt - $tzh:tt : $tzm:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec - $tzh : $tzm) $($rest)*); }; // Parse local datetime `key = 1979-05-27T00:32:00.999999`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt . $frac:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac) $($rest)*); }; // Space instead of T. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt . $frac:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac) $($rest)*); }; // Parse offset datetime `key = 1979-05-27T07:32:00Z` and local datetime `key = 1979-05-27T07:32:00`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec) $($rest)*); }; // Space instead of T. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec) $($rest)*); }; // Parse local date `key = 1979-05-27`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($yr - $mo - $day) $($rest)*); }; // Parse local time `key = 00:32:00.999999`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $hr:tt : $min:tt : $sec:tt . $frac:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($hr : $min : $sec . $frac) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($hr : $min : $sec . $frac) $($rest)*); }; // Parse local time `key = 07:32:00`. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $hr:tt : $min:tt : $sec:tt $($rest:tt)*) => { - $crate::toml_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($hr : $min : $sec) $($rest)*); + $crate::milf_internal!(@topleveldatetime $root [$($path)*] $($($k)-+).+ = ($hr : $min : $sec) $($rest)*); }; // Parse any other `key = value` including string, inline array, inline // table, number, and boolean. (@toplevel $root:ident [$($path:tt)*] $($($k:tt)-+).+ = $v:tt $($rest:tt)*) => {{ - $crate::macros::insert_toml( + $crate::macros::insert_milf( &mut $root, - &[$($path)* $(&concat!($("-", $crate::toml_internal!(@path $k),)+)[1..], )+], - $crate::toml_internal!(@value $v)); - $crate::toml_internal!(@toplevel $root [$($path)*] $($rest)*); + &[$($path)* $(&concat!($("-", $crate::milf_internal!(@path $k),)+)[1..], )+], + $crate::milf_internal!(@value $v)); + $crate::milf_internal!(@toplevel $root [$($path)*] $($rest)*); }}; // Parse array header `[[bin]]`. (@toplevel $root:ident $oldpath:tt [[$($($path:tt)-+).+]] $($rest:tt)*) => { - $crate::macros::push_toml( + $crate::macros::push_milf( &mut $root, - &[$(&concat!($("-", $crate::toml_internal!(@path $path),)+)[1..],)+]); - $crate::toml_internal!(@toplevel $root [$(&concat!($("-", $crate::toml_internal!(@path $path),)+)[1..],)+] $($rest)*); + &[$(&concat!($("-", $crate::milf_internal!(@path $path),)+)[1..],)+]); + $crate::milf_internal!(@toplevel $root [$(&concat!($("-", $crate::milf_internal!(@path $path),)+)[1..],)+] $($rest)*); }; // Parse table header `[patch.crates-io]`. (@toplevel $root:ident $oldpath:tt [$($($path:tt)-+).+] $($rest:tt)*) => { - $crate::macros::insert_toml( + $crate::macros::insert_milf( &mut $root, - &[$(&concat!($("-", $crate::toml_internal!(@path $path),)+)[1..],)+], + &[$(&concat!($("-", $crate::milf_internal!(@path $path),)+)[1..],)+], $crate::Value::Table($crate::value::Table::new())); - $crate::toml_internal!(@toplevel $root [$(&concat!($("-", $crate::toml_internal!(@path $path),)+)[1..],)+] $($rest)*); + $crate::milf_internal!(@toplevel $root [$(&concat!($("-", $crate::milf_internal!(@path $path),)+)[1..],)+] $($rest)*); }; // Parse datetime from string and insert into table. (@topleveldatetime $root:ident [$($path:tt)*] $($($k:tt)-+).+ = ($($datetime:tt)+) $($rest:tt)*) => { - $crate::macros::insert_toml( + $crate::macros::insert_milf( &mut $root, - &[$($path)* $(&concat!($("-", $crate::toml_internal!(@path $k),)+)[1..], )+], + &[$($path)* $(&concat!($("-", $crate::milf_internal!(@path $k),)+)[1..], )+], $crate::Value::Datetime(concat!($(stringify!($datetime)),+).parse().unwrap())); - $crate::toml_internal!(@toplevel $root [$($path)*] $($rest)*); + $crate::milf_internal!(@toplevel $root [$($path)*] $($rest)*); }; // Turn a path segment into a string. @@ -187,14 +187,14 @@ macro_rules! toml_internal { // Construct a Value from an inline table. (@value { $($inline:tt)* }) => {{ let mut table = $crate::Value::Table($crate::value::Table::new()); - $crate::toml_internal!(@trailingcomma (@table table) $($inline)*); + $crate::milf_internal!(@trailingcomma (@table table) $($inline)*); table }}; // Construct a Value from an inline array. (@value [ $($inline:tt)* ]) => {{ let mut array = $crate::value::Array::new(); - $crate::toml_internal!(@trailingcomma (@array array) $($inline)*); + $crate::milf_internal!(@trailingcomma (@array array) $($inline)*); $crate::Value::Array(array) }}; @@ -234,81 +234,81 @@ macro_rules! toml_internal { // Parse negative number `key = -value`. (@table $root:ident $($($k:tt)-+).+ = - $v:tt , $($rest:tt)*) => { - $crate::toml_internal!(@table $root $($($k)-+).+ = (-$v) , $($rest)*); + $crate::milf_internal!(@table $root $($($k)-+).+ = (-$v) , $($rest)*); }; // Parse positive number `key = +value`. (@table $root:ident $($($k:tt)-+).+ = + $v:tt , $($rest:tt)*) => { - $crate::toml_internal!(@table $root $($($k)-+).+ = ($v) , $($rest)*); + $crate::milf_internal!(@table $root $($($k)-+).+ = ($v) , $($rest)*); }; // Parse offset datetime `key = 1979-05-27T00:32:00.999999-07:00`. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt . $frac:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); }; // Space instead of T. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt . $frac:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); }; // Parse offset datetime `key = 1979-05-27T00:32:00-07:00`. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec - $tzh : $tzm) $($rest)*); }; // Space instead of T. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec - $tzh : $tzm) $($rest)*); }; // Parse local datetime `key = 1979-05-27T00:32:00.999999`. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt . $frac:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec . $frac) $($rest)*); }; // Space instead of T. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt . $frac:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec . $frac) $($rest)*); }; // Parse offset datetime `key = 1979-05-27T07:32:00Z` and local datetime `key = 1979-05-27T07:32:00`. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $dhr : $min : $sec) $($rest)*); }; // Space instead of T. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day T $hr : $min : $sec) $($rest)*); }; // Parse local date `key = 1979-05-27`. (@table $root:ident $($($k:tt)-+).+ = $yr:tt - $mo:tt - $day:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($yr - $mo - $day) $($rest)*); }; // Parse local time `key = 00:32:00.999999`. (@table $root:ident $($($k:tt)-+).+ = $hr:tt : $min:tt : $sec:tt . $frac:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($hr : $min : $sec . $frac) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($hr : $min : $sec . $frac) $($rest)*); }; // Parse local time `key = 07:32:00`. (@table $root:ident $($($k:tt)-+).+ = $hr:tt : $min:tt : $sec:tt , $($rest:tt)*) => { - $crate::toml_internal!(@tabledatetime $root $($($k)-+).+ = ($hr : $min : $sec) $($rest)*); + $crate::milf_internal!(@tabledatetime $root $($($k)-+).+ = ($hr : $min : $sec) $($rest)*); }; // Parse any other type, probably string or boolean or number. (@table $root:ident $($($k:tt)-+).+ = $v:tt , $($rest:tt)*) => { - $crate::macros::insert_toml( + $crate::macros::insert_milf( &mut $root, - &[$(&concat!($("-", $crate::toml_internal!(@path $k),)+)[1..], )+], - $crate::toml_internal!(@value $v)); - $crate::toml_internal!(@table $root $($rest)*); + &[$(&concat!($("-", $crate::milf_internal!(@path $k),)+)[1..], )+], + $crate::milf_internal!(@value $v)); + $crate::milf_internal!(@table $root $($rest)*); }; // Parse a Datetime from string and continue in @table state. (@tabledatetime $root:ident $($($k:tt)-+).+ = ($($datetime:tt)*) $($rest:tt)*) => { - $crate::macros::insert_toml( + $crate::macros::insert_milf( &mut $root, - &[$(&concat!($("-", $crate::toml_internal!(@path $k),)+)[1..], )+], + &[$(&concat!($("-", $crate::milf_internal!(@path $k),)+)[1..], )+], $crate::Value::Datetime(concat!($(stringify!($datetime)),+).parse().unwrap())); - $crate::toml_internal!(@table $root $($rest)*); + $crate::milf_internal!(@table $root $($rest)*); }; // Base case of inline array. @@ -316,107 +316,107 @@ macro_rules! toml_internal { // Parse negative number `-value`. (@array $root:ident - $v:tt , $($rest:tt)*) => { - $crate::toml_internal!(@array $root (-$v) , $($rest)*); + $crate::milf_internal!(@array $root (-$v) , $($rest)*); }; // Parse positive number `+value`. (@array $root:ident + $v:tt , $($rest:tt)*) => { - $crate::toml_internal!(@array $root ($v) , $($rest)*); + $crate::milf_internal!(@array $root ($v) , $($rest)*); }; // Parse offset datetime `1979-05-27T00:32:00.999999-07:00`. (@array $root:ident $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt . $frac:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); }; // Space instead of T. (@array $root:ident $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt . $frac:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec . $frac - $tzh : $tzm) $($rest)*); }; // Parse offset datetime `1979-05-27T00:32:00-07:00`. (@array $root:ident $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec - $tzh : $tzm) $($rest)*); }; // Space instead of T. (@array $root:ident $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt - $tzh:tt : $tzm:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec - $tzh : $tzm) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec - $tzh : $tzm) $($rest)*); }; // Parse local datetime `1979-05-27T00:32:00.999999`. (@array $root:ident $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt . $frac:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec . $frac) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec . $frac) $($rest)*); }; // Space instead of T. (@array $root:ident $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt . $frac:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec . $frac) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec . $frac) $($rest)*); }; // Parse offset datetime `1979-05-27T07:32:00Z` and local datetime `1979-05-27T07:32:00`. (@array $root:ident $yr:tt - $mo:tt - $dhr:tt : $min:tt : $sec:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($yr - $mo - $dhr : $min : $sec) $($rest)*); }; // Space instead of T. (@array $root:ident $yr:tt - $mo:tt - $day:tt $hr:tt : $min:tt : $sec:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($yr - $mo - $day T $hr : $min : $sec) $($rest)*); }; // Parse local date `1979-05-27`. (@array $root:ident $yr:tt - $mo:tt - $day:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($yr - $mo - $day) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($yr - $mo - $day) $($rest)*); }; // Parse local time `00:32:00.999999`. (@array $root:ident $hr:tt : $min:tt : $sec:tt . $frac:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($hr : $min : $sec . $frac) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($hr : $min : $sec . $frac) $($rest)*); }; // Parse local time `07:32:00`. (@array $root:ident $hr:tt : $min:tt : $sec:tt , $($rest:tt)*) => { - $crate::toml_internal!(@arraydatetime $root ($hr : $min : $sec) $($rest)*); + $crate::milf_internal!(@arraydatetime $root ($hr : $min : $sec) $($rest)*); }; // Parse any other type, probably string or boolean or number. (@array $root:ident $v:tt , $($rest:tt)*) => { - $root.push($crate::toml_internal!(@value $v)); - $crate::toml_internal!(@array $root $($rest)*); + $root.push($crate::milf_internal!(@value $v)); + $crate::milf_internal!(@array $root $($rest)*); }; // Parse a Datetime from string and continue in @array state. (@arraydatetime $root:ident ($($datetime:tt)*) $($rest:tt)*) => { $root.push($crate::Value::Datetime(concat!($(stringify!($datetime)),+).parse().unwrap())); - $crate::toml_internal!(@array $root $($rest)*); + $crate::milf_internal!(@array $root $($rest)*); }; // No trailing comma required if the tokens are empty. (@trailingcomma ($($args:tt)*)) => { - $crate::toml_internal!($($args)*); + $crate::milf_internal!($($args)*); }; // Tokens end with a trailing comma, do not append another one. (@trailingcomma ($($args:tt)*) ,) => { - $crate::toml_internal!($($args)* ,); + $crate::milf_internal!($($args)* ,); }; // Tokens end with something other than comma, append a trailing comma. (@trailingcomma ($($args:tt)*) $last:tt) => { - $crate::toml_internal!($($args)* $last ,); + $crate::milf_internal!($($args)* $last ,); }; // Not yet at the last token. (@trailingcomma ($($args:tt)*) $first:tt $($rest:tt)+) => { - $crate::toml_internal!(@trailingcomma ($($args)* $first) $($rest)+); + $crate::milf_internal!(@trailingcomma ($($args)* $first) $($rest)+); }; } // Called when parsing a `key = value` pair. // Inserts an entry into the table at the given path. -pub fn insert_toml(root: &mut Value, path: &[&str], value: Value) { +pub fn insert_milf(root: &mut Value, path: &[&str], value: Value) { *traverse(root, path) = value; } // Called when parsing an `[[array header]]`. // Pushes an empty table onto the array at the given path. -pub fn push_toml(root: &mut Value, path: &[&str]) { +pub fn push_milf(root: &mut Value, path: &[&str]) { let target = traverse(root, path); if !target.is_array() { *target = Value::Array(Array::new()); @@ -434,7 +434,7 @@ fn traverse<'a>(root: &'a mut Value, path: &[&str]) -> &'a mut Value { let cur1 = cur; let cur2; - // From the TOML spec: + // From the MILF spec: // // > Each double-bracketed sub-table will belong to the most recently // > defined table element above it. @@ -6,10 +6,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! A map of String to toml::Value. +//! A map of String to milf::Value. //! //! By default the map is backed by a [`BTreeMap`]. Enable the `preserve_order` -//! feature of toml-rs to use [`LinkedHashMap`] instead. +//! feature of milf-rs to use [`LinkedHashMap`] instead. //! //! [`BTreeMap`]: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html //! [`LinkedHashMap`]: https://docs.rs/linked-hash-map/*/linked_hash_map/struct.LinkedHashMap.html @@ -28,7 +28,7 @@ use std::collections::{btree_map, BTreeMap}; #[cfg(feature = "preserve_order")] use indexmap::{self, IndexMap}; -/// Represents a TOML key/value type. +/// Represents a MILF key/value type. pub struct Map<K, V> { map: MapImpl<K, V>, } @@ -504,7 +504,7 @@ impl<'a> IntoIterator for &'a Map<String, Value> { } } -/// An iterator over a toml::Map's entries. +/// An iterator over a milf::Map's entries. pub struct Iter<'a> { iter: IterImpl<'a>, } @@ -529,7 +529,7 @@ impl<'a> IntoIterator for &'a mut Map<String, Value> { } } -/// A mutable iterator over a toml::Map's entries. +/// A mutable iterator over a milf::Map's entries. pub struct IterMut<'a> { iter: IterMutImpl<'a>, } @@ -554,7 +554,7 @@ impl IntoIterator for Map<String, Value> { } } -/// An owning iterator over a toml::Map's entries. +/// An owning iterator over a milf::Map's entries. pub struct IntoIter { iter: IntoIterImpl, } @@ -568,7 +568,7 @@ delegate_iterator!((IntoIter) => (String, Value)); ////////////////////////////////////////////////////////////////////////////// -/// An iterator over a toml::Map's keys. +/// An iterator over a milf::Map's keys. pub struct Keys<'a> { iter: KeysImpl<'a>, } @@ -582,7 +582,7 @@ delegate_iterator!((Keys<'a>) => &'a String); ////////////////////////////////////////////////////////////////////////////// -/// An iterator over a toml::Map's values. +/// An iterator over a milf::Map's values. pub struct Values<'a> { iter: ValuesImpl<'a>, } @@ -1,10 +1,10 @@ -//! Serializing Rust structures into TOML. +//! Serializing Rust structures into MILF. //! //! This module contains all the Serde support for serializing Rust structures -//! into TOML documents (as strings). Note that some top-level functions here +//! into MILF documents (as strings). Note that some top-level functions here //! are also provided at the top of the crate. //! -//! Note that the TOML format has a restriction that if a table itself contains +//! Note that the MILF format has a restriction that if a table itself contains //! tables, all keys with non-table values must be emitted first. This is //! typically easy to ensure happens when you're defining a `struct` as you can //! reorder the fields manually, but when working with maps (such as `BTreeMap` @@ -17,7 +17,7 @@ //! #[derive(Serialize)] //! struct Manifest { //! package: Package, -//! #[serde(serialize_with = "toml::ser::tables_last")] +//! #[serde(serialize_with = "milf::ser::tables_last")] //! dependencies: HashMap<String, Dependency>, //! } //! # type Package = String; @@ -34,7 +34,7 @@ use std::rc::Rc; use crate::datetime; use serde::ser; -/// Serialize the given data structure as a TOML byte vector. +/// Serialize the given data structure as a MILF byte vector. /// /// Serialization can fail if `T`'s implementation of `Serialize` decides to /// fail, if `T` contains a map with non-string keys, or if `T` attempts to @@ -46,7 +46,7 @@ where to_string(value).map(|e| e.into_bytes()) } -/// Serialize the given data structure as a String of TOML. +/// Serialize the given data structure as a String of MILF. /// /// Serialization can fail if `T`'s implementation of `Serialize` decides to /// fail, if `T` contains a map with non-string keys, or if `T` attempts to @@ -80,8 +80,8 @@ where /// }, /// }; /// -/// let toml = toml::to_string(&config).unwrap(); -/// println!("{}", toml) +/// let milf = milf::to_string(&config).unwrap(); +/// println!("{}", milf) /// } /// ``` pub fn to_string<T: ?Sized>(value: &T) -> Result<String, Error> @@ -93,7 +93,7 @@ where Ok(dst) } -/// Serialize the given data structure as a "pretty" String of TOML. +/// Serialize the given data structure as a "pretty" String of MILF. /// /// This is identical to `to_string` except the output string has a more /// "pretty" output. See `Serializer::pretty` for more details. @@ -112,11 +112,11 @@ pub enum Error { /// Indicates that a Rust type was requested to be serialized but it was not /// supported. /// - /// Currently the TOML format does not support serializing types such as + /// Currently the MILF format does not support serializing types such as /// enums, tuples and tuple structs. UnsupportedType, - /// The key of all TOML maps must be strings, but serialization was + /// The key of all MILF maps must be strings, but serialization was /// attempted where the key of a map was not a string. KeyNotString, @@ -128,7 +128,7 @@ pub enum Error { #[doc(hidden)] ArrayMixedType, - /// All values in a TOML table must be emitted before further tables are + /// All values in a MILF table must be emitted before further tables are /// emitted. If a value is emitted *after* a table then this error is /// generated. ValueAfterTable, @@ -186,10 +186,10 @@ struct Settings { string: Option<StringSettings>, } -/// Serialization implementation for TOML. +/// Serialization implementation for MILF. /// -/// This structure implements serialization support for TOML to serialize an -/// arbitrary type to TOML. Note that the TOML format does not support all +/// This structure implements serialization support for MILF to serialize an +/// arbitrary type to MILF. Note that the MILF format does not support all /// datatypes in Rust, such as enums, tuples, and tuple structs. These types /// will generate an error when serialized. /// @@ -244,7 +244,7 @@ pub enum SerializeTable<'a, 'b> { } impl<'a> Serializer<'a> { - /// Creates a new serializer which will emit TOML into the buffer provided. + /// Creates a new serializer which will emit MILF into the buffer provided. /// /// The serializer can then be used to serialize a type after which the data /// will be present in `dst`. @@ -1558,9 +1558,9 @@ enum Category { } /// Convenience function to serialize items in a map in an order valid with -/// TOML. +/// MILF. /// -/// TOML carries the restriction that keys in a table must be serialized last if +/// MILF carries the restriction that keys in a table must be serialized last if /// their value is a table itself. This isn't always easy to guarantee, so this /// helper can be used like so: /// @@ -1570,7 +1570,7 @@ enum Category { /// #[derive(Serialize)] /// struct Manifest { /// package: Package, -/// #[serde(serialize_with = "toml::ser::tables_last")] +/// #[serde(serialize_with = "milf::ser::tables_last")] /// dependencies: HashMap<String, Dependency>, /// } /// # type Package = String; diff --git a/src/spanned.rs b/src/spanned.rs index 9ee56ae..6c49eb9 100644 --- a/src/spanned.rs +++ b/src/spanned.rs @@ -4,16 +4,16 @@ use std::cmp::Ordering; use std::fmt; use std::hash::{Hash, Hasher}; -pub(crate) const NAME: &str = "$__toml_private_Spanned"; -pub(crate) const START: &str = "$__toml_private_start"; -pub(crate) const END: &str = "$__toml_private_end"; -pub(crate) const VALUE: &str = "$__toml_private_value"; +pub(crate) const NAME: &str = "$__milf_private_Spanned"; +pub(crate) const START: &str = "$__milf_private_start"; +pub(crate) const END: &str = "$__milf_private_end"; +pub(crate) const VALUE: &str = "$__milf_private_value"; /// A spanned value, indicating the range at which it is defined in the source. /// /// ``` /// use serde_derive::Deserialize; -/// use toml::Spanned; +/// use milf::Spanned; /// /// #[derive(Deserialize)] /// struct Value { @@ -23,7 +23,7 @@ pub(crate) const VALUE: &str = "$__toml_private_value"; /// fn main() { /// let t = "s = \"value\"\n"; /// -/// let u: Value = toml::from_str(t).unwrap(); +/// let u: Value = milf::from_str(t).unwrap(); /// /// assert_eq!(u.s.start(), 4); /// assert_eq!(u.s.end(), 11); @@ -122,7 +122,7 @@ where type Value = Spanned<T>; fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { - formatter.write_str("a TOML spanned") + formatter.write_str("a MILF spanned") } fn visit_map<V>(self, mut visitor: V) -> Result<Spanned<T>, V::Error> diff --git a/src/value.rs b/src/value.rs index 38dfe1f..5bb0c55 100644 --- a/src/value.rs +++ b/src/value.rs @@ -1,4 +1,4 @@ -//! Definition of a TOML value +//! Definition of a MILF value use std::collections::{BTreeMap, HashMap}; use std::fmt; @@ -17,36 +17,36 @@ pub use crate::datetime::{Datetime, DatetimeParseError}; pub use crate::map::Map; -/// Representation of a TOML value. +/// Representation of a MILF value. #[derive(PartialEq, Clone, Debug)] pub enum Value { - /// Represents a TOML string + /// Represents a MILF string String(String), - /// Represents a TOML integer + /// Represents a MILF integer Integer(i64), - /// Represents a TOML float + /// Represents a MILF float Float(f64), - /// Represents a TOML boolean + /// Represents a MILF boolean Boolean(bool), - /// Represents a TOML datetime + /// Represents a MILF datetime Datetime(Datetime), - /// Represents a TOML array + /// Represents a MILF array Array(Array), - /// Represents a TOML table + /// Represents a MILF table Table(Table), } -/// Type representing a TOML array, payload of the `Value::Array` variant +/// Type representing a MILF array, payload of the `Value::Array` variant pub type Array = Vec<Value>; -/// Type representing a TOML table, payload of the `Value::Table` variant. +/// Type representing a MILF table, payload of the `Value::Table` variant. /// By default it is backed by a BTreeMap, enable the `preserve_order` feature /// to use a LinkedHashMap instead. pub type Table = Map<String, Value>; impl Value { - /// Convert a `T` into `toml::Value` which is an enum that can represent - /// any valid TOML data. + /// Convert a `T` into `milf::Value` which is an enum that can represent + /// any valid MILF data. /// /// This conversion can fail if `T`'s implementation of `Serialize` decides to /// fail, or if `T` contains a map with non-string keys. @@ -57,14 +57,14 @@ impl Value { value.serialize(Serializer) } - /// Interpret a `toml::Value` as an instance of type `T`. + /// Interpret a `milf::Value` as an instance of type `T`. /// /// This conversion can fail if the structure of the `Value` does not match the /// structure expected by `T`, for example if `T` is a struct type but the - /// `Value` contains something other than a TOML table. It can also fail if the + /// `Value` contains something other than a MILF table. It can also fail if the /// structure is correct but `T`'s implementation of `Deserialize` decides that /// something is wrong with the data, for example required struct fields are - /// missing from the TOML map or some number is too big to fit in the expected + /// missing from the MILF map or some number is too big to fit in the expected /// primitive type. pub fn try_into<'de, T>(self) -> Result<T, crate::de::Error> where @@ -73,7 +73,7 @@ impl Value { de::Deserialize::deserialize(self) } - /// Index into a TOML array or map. A string index can be used to access a + /// Index into a MILF array or map. A string index can be used to access a /// value in a map, and a usize index can be used to access an element of an /// array. /// @@ -85,7 +85,7 @@ impl Value { index.index(self) } - /// Mutably index into a TOML array or map. A string index can be used to + /// Mutably index into a MILF array or map. A string index can be used to /// access a value in a map, and a usize index can be used to access an /// element of an array. /// @@ -151,7 +151,7 @@ impl Value { /// Extracts the datetime value if it is a datetime. /// - /// Note that a parsed TOML value will only contain ISO 8601 dates. An + /// Note that a parsed MILF value will only contain ISO 8601 dates. An /// example date is: /// /// ```notrust @@ -302,13 +302,13 @@ impl_into_value!(Boolean: bool); impl_into_value!(Datetime: Datetime); impl_into_value!(Table: Table); -/// Types that can be used to index a `toml::Value` +/// Types that can be used to index a `milf::Value` /// /// Currently this is implemented for `usize` to index arrays and `str` to index /// tables. /// /// This trait is sealed and not intended for implementation outside of the -/// `toml` crate. +/// `milf` crate. pub trait Index: Sealed { #[doc(hidden)] fn index<'a>(&self, val: &'a Value) -> Option<&'a Value>; @@ -453,7 +453,7 @@ impl<'de> de::Deserialize<'de> for Value { type Value = Value; fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { - formatter.write_str("any valid TOML value") + formatter.write_str("any valid MILF value") } fn visit_bool<E>(self, value: bool) -> Result<Value, E> { diff --git a/test-suite/Cargo.toml b/test-suite/Cargo.toml index 4d539c8..5122cfc 100644 --- a/test-suite/Cargo.toml +++ b/test-suite/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "toml_test_suite" +name = "milf_test_suite" version = "0.0.0" authors = ["Alex Crichton <alex@alexcrichton.com>"] publish = false @@ -11,7 +11,7 @@ harness = false [dev-dependencies] bencher = "0.1" -toml = { path = ".." } +milf = { path = ".." } serde = { version = "1.0", features = ["derive"] } serde_derive = "1.0" serde_json = "1.0" diff --git a/test-suite/benches/linear.rs b/test-suite/benches/linear.rs index 1553595..5ba8174 100644 --- a/test-suite/benches/linear.rs +++ b/test-suite/benches/linear.rs @@ -1,7 +1,7 @@ // Regressoion test for https://github.com/alexcrichton/toml-rs/issues/342 use bencher::{benchmark_group, benchmark_main, black_box, Bencher}; -use toml::Value; +use milf::Value; fn parse(bench: &mut Bencher, entries: usize, f: impl Fn(usize) -> String) { let mut s = String::new(); diff --git a/test-suite/tests/backcompat.rs b/test-suite/tests/backcompat.rs index ef3bd36..7d4fcee 100644 --- a/test-suite/tests/backcompat.rs +++ b/test-suite/tests/backcompat.rs @@ -1,11 +1,11 @@ extern crate serde; -extern crate toml; +extern crate milf; use serde::de::Deserialize; macro_rules! bad { - ($toml:expr, $msg:expr) => { - match $toml.parse::<toml::Value>() { + ($milf:expr, $msg:expr) => { + match $milf.parse::<milf::Value>() { Ok(s) => panic!("parsed to: {:#?}", s), Err(e) => assert_eq!(e.to_string(), $msg), } @@ -23,9 +23,9 @@ fn newlines_after_tables() { "expected newline, found an identifier at line 2 column 13" ); - let mut d = toml::de::Deserializer::new(s); + let mut d = milf::de::Deserializer::new(s); d.set_require_newline_after_table(false); - let value = toml::Value::deserialize(&mut d).unwrap(); + let value = milf::Value::deserialize(&mut d).unwrap(); assert_eq!(value["a"]["foo"].as_integer(), Some(1)); assert_eq!(value["b"][0]["foo"].as_integer(), Some(1)); } @@ -47,9 +47,9 @@ fn allow_duplicate_after_longer() { "redefinition of table `dependencies` for key `dependencies` at line 8 column 9" ); - let mut d = toml::de::Deserializer::new(s); + let mut d = milf::de::Deserializer::new(s); d.set_allow_duplicate_after_longer_table(true); - let value = toml::Value::deserialize(&mut d).unwrap(); + let value = milf::Value::deserialize(&mut d).unwrap(); assert_eq!( value["dependencies"]["openssl-sys"]["version"].as_integer(), Some(1) diff --git a/test-suite/tests/datetime.rs b/test-suite/tests/datetime.rs index 6c08748..729591e 100644 --- a/test-suite/tests/datetime.rs +++ b/test-suite/tests/datetime.rs @@ -1,10 +1,10 @@ -extern crate toml; +extern crate milf; use std::str::FromStr; macro_rules! bad { - ($toml:expr, $msg:expr) => { - match $toml.parse::<toml::Value>() { + ($milf:expr, $msg:expr) => { + match $milf.parse::<milf::Value>() { Ok(s) => panic!("parsed to: {:#?}", s), Err(e) => assert_eq!(e.to_string(), $msg), } @@ -15,7 +15,7 @@ macro_rules! bad { fn times() { fn dogood(s: &str, serialized: &str) { let to_parse = format!("foo = {}", s); - let value = toml::Value::from_str(&to_parse).unwrap(); + let value = milf::Value::from_str(&to_parse).unwrap(); assert_eq!(value["foo"].as_datetime().unwrap().to_string(), serialized); } fn good(s: &str) { @@ -68,15 +68,15 @@ fn bad_times() { ); bad!( "foo = T", - "invalid TOML value, did you mean to use a quoted string? at line 1 column 7" + "invalid MILF value, did you mean to use a quoted string? at line 1 column 7" ); bad!( "foo = T.", - "invalid TOML value, did you mean to use a quoted string? at line 1 column 7" + "invalid MILF value, did you mean to use a quoted string? at line 1 column 7" ); bad!( "foo = TZ", - "invalid TOML value, did you mean to use a quoted string? at line 1 column 7" + "invalid MILF value, did you mean to use a quoted string? at line 1 column 7" ); bad!( "foo = 1997-09-09T09:09:09.09+", diff --git a/test-suite/tests/de-errors.rs b/test-suite/tests/de-errors.rs index 7666489..656dd49 100644 --- a/test-suite/tests/de-errors.rs +++ b/test-suite/tests/de-errors.rs @@ -1,12 +1,12 @@ extern crate serde; -extern crate toml; +extern crate milf; use serde::{de, Deserialize}; use std::fmt; macro_rules! bad { - ($toml:expr, $ty:ty, $msg:expr) => { - match toml::from_str::<$ty>($toml) { + ($milf:expr, $ty:ty, $msg:expr) => { + match milf::from_str::<$ty>($milf) { Ok(s) => panic!("parsed to: {:#?}", s), Err(e) => assert_eq!(e.to_string(), $msg), } @@ -71,7 +71,7 @@ impl<'de> de::Deserialize<'de> for CasedString { #[test] fn custom_errors() { - toml::from_str::<Parent<CasedString>>( + milf::from_str::<Parent<CasedString>>( " p_a = 'a' p_b = [{c_a = 'a', c_b = 'c'}] @@ -333,7 +333,7 @@ fn error_handles_crlf() { a = 1\r\n\ a = 2\r\n\ ", - toml::Value, + milf::Value, "duplicate key: `a` for key `t2` at line 3 column 1" ); @@ -345,7 +345,7 @@ fn error_handles_crlf() { a = 1\n\ a = 2\n\ ", - toml::Value, + milf::Value, "duplicate key: `a` for key `t2` at line 3 column 1" ); } diff --git a/test-suite/tests/display-tricky.rs b/test-suite/tests/display-tricky.rs index 0daa10e..631ce70 100644 --- a/test-suite/tests/display-tricky.rs +++ b/test-suite/tests/display-tricky.rs @@ -1,4 +1,4 @@ -extern crate toml; +extern crate milf; #[macro_use] extern crate serde_derive; @@ -26,7 +26,7 @@ pub struct Packages { #[test] fn both_ends() { - let recipe_works = toml::from_str::<Recipe>( + let recipe_works = milf::from_str::<Recipe>( r#" name = "testing" description = "example" @@ -37,9 +37,9 @@ fn both_ends() { "#, ) .unwrap(); - toml::to_string(&recipe_works).unwrap(); + milf::to_string(&recipe_works).unwrap(); - let recipe_fails = toml::from_str::<Recipe>( + let recipe_fails = milf::from_str::<Recipe>( r#" name = "testing" description = "example" @@ -51,6 +51,6 @@ fn both_ends() { ) .unwrap(); - let recipe_toml = toml::Value::try_from(recipe_fails).unwrap(); - recipe_toml.to_string(); + let recipe_milf = milf::Value::try_from(recipe_fails).unwrap(); + recipe_milf.to_string(); } diff --git a/test-suite/tests/display.rs b/test-suite/tests/display.rs index 5d9f44a..73067e6 100644 --- a/test-suite/tests/display.rs +++ b/test-suite/tests/display.rs @@ -1,7 +1,7 @@ -extern crate toml; +extern crate milf; -use toml::map::Map; -use toml::Value::{Array, Boolean, Float, Integer, String, Table}; +use milf::map::Map; +use milf::Value::{Array, Boolean, Float, Integer, String, Table}; macro_rules! map( ($($k:expr => $v:expr),*) => ({ let mut _m = Map::new(); diff --git a/test-suite/tests/float.rs b/test-suite/tests/float.rs index 66414ea..0b639dc 100644 --- a/test-suite/tests/float.rs +++ b/test-suite/tests/float.rs @@ -1,8 +1,8 @@ -extern crate toml; +extern crate milf; #[macro_use] extern crate serde_derive; -use toml::Value; +use milf::Value; #[rustfmt::skip] // appears to be a bug in rustfmt to make this converge... macro_rules! float_inf_tests { @@ -18,7 +18,7 @@ macro_rules! float_inf_tests { sf7: $ty, sf8: $ty, } - let inf: S = toml::from_str( + let inf: S = milf::from_str( r" # infinity sf1 = inf # positive infinity @@ -56,7 +56,7 @@ macro_rules! float_inf_tests { assert_eq!(inf.sf8, 0.0); assert!(inf.sf8.is_sign_negative()); - let s = toml::to_string(&inf).unwrap(); + let s = milf::to_string(&inf).unwrap(); assert_eq!( s, "\ @@ -71,7 +71,7 @@ sf8 = -0.0 " ); - toml::from_str::<Value>(&s).expect("roundtrip"); + milf::from_str::<Value>(&s).expect("roundtrip"); }}; } diff --git a/test-suite/tests/formatting.rs b/test-suite/tests/formatting.rs index 8e15ec2..b459d5f 100644 --- a/test-suite/tests/formatting.rs +++ b/test-suite/tests/formatting.rs @@ -1,8 +1,8 @@ #[macro_use] extern crate serde_derive; -extern crate toml; +extern crate milf; -use toml::to_string; +use milf::to_string; #[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize, Deserialize)] struct User { diff --git a/test-suite/tests/invalid-misc.rs b/test-suite/tests/invalid-misc.rs index cea0801..14fc6c3 100644 --- a/test-suite/tests/invalid-misc.rs +++ b/test-suite/tests/invalid-misc.rs @@ -1,8 +1,8 @@ -extern crate toml; +extern crate milf; macro_rules! bad { - ($toml:expr, $msg:expr) => { - match $toml.parse::<toml::Value>() { + ($milf:expr, $msg:expr) => { + match $milf.parse::<milf::Value>() { Ok(s) => panic!("parsed to: {:#?}", s), Err(e) => assert_eq!(e.to_string(), $msg), } diff --git a/test-suite/tests/invalid.rs b/test-suite/tests/invalid.rs index f04d860..119e748 100644 --- a/test-suite/tests/invalid.rs +++ b/test-suite/tests/invalid.rs @@ -1,8 +1,8 @@ -extern crate toml; +extern crate milf; macro_rules! bad { - ($toml:expr, $msg:expr) => { - match $toml.parse::<toml::Value>() { + ($milf:expr, $msg:expr) => { + match $milf.parse::<milf::Value>() { Ok(s) => panic!("parsed to: {:#?}", s), Err(e) => assert_eq!(e.to_string(), $msg), } @@ -16,211 +16,211 @@ macro_rules! test( ($name:ident, $s:expr, $msg:expr) => ( test!( datetime_malformed_no_leads, - include_str!("invalid/datetime-malformed-no-leads.toml"), + include_str!("invalid/datetime-malformed-no-leads.milf"), "failed to parse datetime for key `no-leads` at line 1 column 12" ); test!( datetime_malformed_no_secs, - include_str!("invalid/datetime-malformed-no-secs.toml"), + include_str!("invalid/datetime-malformed-no-secs.milf"), "expected a colon, found a newline at line 1 column 28" ); test!( datetime_malformed_no_t, - include_str!("invalid/datetime-malformed-no-t.toml"), + include_str!("invalid/datetime-malformed-no-t.milf"), "failed to parse datetime for key `no-t` at line 1 column 8" ); test!( datetime_malformed_with_milli, - include_str!("invalid/datetime-malformed-with-milli.toml"), + include_str!("invalid/datetime-malformed-with-milli.milf"), "failed to parse datetime for key `with-milli` at line 1 column 14" ); test!( duplicate_key_table, - include_str!("invalid/duplicate-key-table.toml"), + include_str!("invalid/duplicate-key-table.milf"), "duplicate key: `type` for key `fruit` at line 4 column 1" ); test!( duplicate_keys, - include_str!("invalid/duplicate-keys.toml"), + include_str!("invalid/duplicate-keys.milf"), "duplicate key: `dupe` at line 1 column 1" ); test!( duplicate_table, - include_str!("invalid/duplicate-table.toml"), + include_str!("invalid/duplicate-table.milf"), "redefinition of table `dependencies` for key `dependencies` at line 7 column 1" ); test!( duplicate_tables, - include_str!("invalid/duplicate-tables.toml"), + include_str!("invalid/duplicate-tables.milf"), "redefinition of table `a` for key `a` at line 2 column 1" ); test!( empty_implicit_table, - include_str!("invalid/empty-implicit-table.toml"), + include_str!("invalid/empty-implicit-table.milf"), "expected a table key, found a period at line 1 column 10" ); test!( empty_table, - include_str!("invalid/empty-table.toml"), + include_str!("invalid/empty-table.milf"), "expected a table key, found a right bracket at line 1 column 2" ); test!( float_no_leading_zero, - include_str!("invalid/float-no-leading-zero.toml"), + include_str!("invalid/float-no-leading-zero.milf"), "expected a value, found a period at line 1 column 10" ); test!( float_no_suffix, - include_str!("invalid/float-no-suffix.toml"), + include_str!("invalid/float-no-suffix.milf"), "invalid number at line 1 column 5" ); test!( float_no_trailing_digits, - include_str!("invalid/float-no-trailing-digits.toml"), + include_str!("invalid/float-no-trailing-digits.milf"), "invalid number at line 1 column 12" ); test!( key_after_array, - include_str!("invalid/key-after-array.toml"), + include_str!("invalid/key-after-array.milf"), "expected newline, found an identifier at line 1 column 14" ); test!( key_after_table, - include_str!("invalid/key-after-table.toml"), + include_str!("invalid/key-after-table.milf"), "expected newline, found an identifier at line 1 column 11" ); test!( key_empty, - include_str!("invalid/key-empty.toml"), + include_str!("invalid/key-empty.milf"), "expected a table key, found an equals at line 1 column 2" ); test!( key_hash, - include_str!("invalid/key-hash.toml"), + include_str!("invalid/key-hash.milf"), "expected an equals, found a comment at line 1 column 2" ); test!( key_newline, - include_str!("invalid/key-newline.toml"), + include_str!("invalid/key-newline.milf"), "expected an equals, found a newline at line 1 column 2" ); test!( key_open_bracket, - include_str!("invalid/key-open-bracket.toml"), + include_str!("invalid/key-open-bracket.milf"), "expected a right bracket, found an equals at line 1 column 6" ); test!( key_single_open_bracket, - include_str!("invalid/key-single-open-bracket.toml"), + include_str!("invalid/key-single-open-bracket.milf"), "expected a table key, found eof at line 1 column 2" ); test!( key_space, - include_str!("invalid/key-space.toml"), + include_str!("invalid/key-space.milf"), "expected an equals, found an identifier at line 1 column 3" ); test!( key_start_bracket, - include_str!("invalid/key-start-bracket.toml"), + include_str!("invalid/key-start-bracket.milf"), "expected a right bracket, found an equals at line 2 column 6" ); test!( key_two_equals, - include_str!("invalid/key-two-equals.toml"), + include_str!("invalid/key-two-equals.milf"), "expected a value, found an equals at line 1 column 6" ); test!( string_bad_byte_escape, - include_str!("invalid/string-bad-byte-escape.toml"), + include_str!("invalid/string-bad-byte-escape.milf"), "invalid escape character in string: `x` at line 1 column 13" ); test!( string_bad_escape, - include_str!("invalid/string-bad-escape.toml"), + include_str!("invalid/string-bad-escape.milf"), "invalid escape character in string: `a` at line 1 column 42" ); test!( string_bad_line_ending_escape, - include_str!("invalid/string-bad-line-ending-escape.toml"), + include_str!("invalid/string-bad-line-ending-escape.milf"), "invalid escape character in string: ` ` at line 2 column 79" ); test!( string_byte_escapes, - include_str!("invalid/string-byte-escapes.toml"), + include_str!("invalid/string-byte-escapes.milf"), "invalid escape character in string: `x` at line 1 column 12" ); test!( string_no_close, - include_str!("invalid/string-no-close.toml"), + include_str!("invalid/string-no-close.milf"), "newline in string found at line 1 column 42" ); test!( table_array_implicit, - include_str!("invalid/table-array-implicit.toml"), + include_str!("invalid/table-array-implicit.milf"), "table redefined as array for key `albums` at line 13 column 1" ); test!( table_array_malformed_bracket, - include_str!("invalid/table-array-malformed-bracket.toml"), + include_str!("invalid/table-array-malformed-bracket.milf"), "expected a right bracket, found a newline at line 1 column 10" ); test!( table_array_malformed_empty, - include_str!("invalid/table-array-malformed-empty.toml"), + include_str!("invalid/table-array-malformed-empty.milf"), "expected a table key, found a right bracket at line 1 column 3" ); test!( table_empty, - include_str!("invalid/table-empty.toml"), + include_str!("invalid/table-empty.milf"), "expected a table key, found a right bracket at line 1 column 2" ); test!( table_nested_brackets_close, - include_str!("invalid/table-nested-brackets-close.toml"), + include_str!("invalid/table-nested-brackets-close.milf"), "expected newline, found an identifier at line 1 column 4" ); test!( table_nested_brackets_open, - include_str!("invalid/table-nested-brackets-open.toml"), + include_str!("invalid/table-nested-brackets-open.milf"), "expected a right bracket, found a left bracket at line 1 column 3" ); test!( table_whitespace, - include_str!("invalid/table-whitespace.toml"), + include_str!("invalid/table-whitespace.milf"), "expected a right bracket, found an identifier at line 1 column 10" ); test!( table_with_pound, - include_str!("invalid/table-with-pound.toml"), + include_str!("invalid/table-with-pound.milf"), "expected a right bracket, found a comment at line 1 column 5" ); test!( text_after_array_entries, - include_str!("invalid/text-after-array-entries.toml"), - "invalid TOML value, did you mean to use a quoted string? at line 2 column 46" + include_str!("invalid/text-after-array-entries.milf"), + "invalid MILF value, did you mean to use a quoted string? at line 2 column 46" ); test!( text_after_integer, - include_str!("invalid/text-after-integer.toml"), + include_str!("invalid/text-after-integer.milf"), "expected newline, found an identifier at line 1 column 13" ); test!( text_after_string, - include_str!("invalid/text-after-string.toml"), + include_str!("invalid/text-after-string.milf"), "expected newline, found an identifier at line 1 column 41" ); test!( text_after_table, - include_str!("invalid/text-after-table.toml"), + include_str!("invalid/text-after-table.milf"), "expected newline, found an identifier at line 1 column 9" ); test!( text_before_array_separator, - include_str!("invalid/text-before-array-separator.toml"), + include_str!("invalid/text-before-array-separator.milf"), "expected a right bracket, found an identifier at line 2 column 46" ); test!( text_in_array, - include_str!("invalid/text-in-array.toml"), - "invalid TOML value, did you mean to use a quoted string? at line 3 column 3" + include_str!("invalid/text-in-array.milf"), + "invalid MILF value, did you mean to use a quoted string? at line 3 column 3" ); diff --git a/test-suite/tests/invalid/datetime-malformed-no-leads.toml b/test-suite/tests/invalid/datetime-malformed-no-leads.milf index 123f173..123f173 100644 --- a/test-suite/tests/invalid/datetime-malformed-no-leads.toml +++ b/test-suite/tests/invalid/datetime-malformed-no-leads.milf diff --git a/test-suite/tests/invalid/datetime-malformed-no-secs.toml b/test-suite/tests/invalid/datetime-malformed-no-secs.milf index ba93900..ba93900 100644 --- a/test-suite/tests/invalid/datetime-malformed-no-secs.toml +++ b/test-suite/tests/invalid/datetime-malformed-no-secs.milf diff --git a/test-suite/tests/invalid/datetime-malformed-no-t.toml b/test-suite/tests/invalid/datetime-malformed-no-t.milf index 617e3c5..617e3c5 100644 --- a/test-suite/tests/invalid/datetime-malformed-no-t.toml +++ b/test-suite/tests/invalid/datetime-malformed-no-t.milf diff --git a/test-suite/tests/invalid/datetime-malformed-with-milli.toml b/test-suite/tests/invalid/datetime-malformed-with-milli.milf index eef792f..eef792f 100644 --- a/test-suite/tests/invalid/datetime-malformed-with-milli.toml +++ b/test-suite/tests/invalid/datetime-malformed-with-milli.milf diff --git a/test-suite/tests/invalid/duplicate-key-table.toml b/test-suite/tests/invalid/duplicate-key-table.milf index cedf05f..cedf05f 100644 --- a/test-suite/tests/invalid/duplicate-key-table.toml +++ b/test-suite/tests/invalid/duplicate-key-table.milf diff --git a/test-suite/tests/invalid/duplicate-keys.toml b/test-suite/tests/invalid/duplicate-keys.milf index 9b5aee0..9b5aee0 100644 --- a/test-suite/tests/invalid/duplicate-keys.toml +++ b/test-suite/tests/invalid/duplicate-keys.milf diff --git a/test-suite/tests/invalid/duplicate-table.toml b/test-suite/tests/invalid/duplicate-table.milf index 5bd2571..5bd2571 100644 --- a/test-suite/tests/invalid/duplicate-table.toml +++ b/test-suite/tests/invalid/duplicate-table.milf diff --git a/test-suite/tests/invalid/duplicate-tables.toml b/test-suite/tests/invalid/duplicate-tables.milf index 8ddf49b..8ddf49b 100644 --- a/test-suite/tests/invalid/duplicate-tables.toml +++ b/test-suite/tests/invalid/duplicate-tables.milf diff --git a/test-suite/tests/invalid/empty-implicit-table.toml b/test-suite/tests/invalid/empty-implicit-table.milf index 0cc36d0..0cc36d0 100644 --- a/test-suite/tests/invalid/empty-implicit-table.toml +++ b/test-suite/tests/invalid/empty-implicit-table.milf diff --git a/test-suite/tests/invalid/empty-table.toml b/test-suite/tests/invalid/empty-table.milf index fe51488..fe51488 100644 --- a/test-suite/tests/invalid/empty-table.toml +++ b/test-suite/tests/invalid/empty-table.milf diff --git a/test-suite/tests/invalid/float-no-leading-zero.toml b/test-suite/tests/invalid/float-no-leading-zero.milf index cab76bf..cab76bf 100644 --- a/test-suite/tests/invalid/float-no-leading-zero.toml +++ b/test-suite/tests/invalid/float-no-leading-zero.milf diff --git a/test-suite/tests/invalid/float-no-suffix.toml b/test-suite/tests/invalid/float-no-suffix.milf index 76106de..76106de 100644 --- a/test-suite/tests/invalid/float-no-suffix.toml +++ b/test-suite/tests/invalid/float-no-suffix.milf diff --git a/test-suite/tests/invalid/float-no-trailing-digits.toml b/test-suite/tests/invalid/float-no-trailing-digits.milf index cbff2d0..cbff2d0 100644 --- a/test-suite/tests/invalid/float-no-trailing-digits.toml +++ b/test-suite/tests/invalid/float-no-trailing-digits.milf diff --git a/test-suite/tests/invalid/key-after-array.toml b/test-suite/tests/invalid/key-after-array.milf index 5c1a1b0..5c1a1b0 100644 --- a/test-suite/tests/invalid/key-after-array.toml +++ b/test-suite/tests/invalid/key-after-array.milf diff --git a/test-suite/tests/invalid/key-after-table.toml b/test-suite/tests/invalid/key-after-table.milf index 4bc8213..4bc8213 100644 --- a/test-suite/tests/invalid/key-after-table.toml +++ b/test-suite/tests/invalid/key-after-table.milf diff --git a/test-suite/tests/invalid/key-empty.toml b/test-suite/tests/invalid/key-empty.milf index 09f998f..09f998f 100644 --- a/test-suite/tests/invalid/key-empty.toml +++ b/test-suite/tests/invalid/key-empty.milf diff --git a/test-suite/tests/invalid/key-hash.toml b/test-suite/tests/invalid/key-hash.milf index e321b1f..e321b1f 100644 --- a/test-suite/tests/invalid/key-hash.toml +++ b/test-suite/tests/invalid/key-hash.milf diff --git a/test-suite/tests/invalid/key-newline.toml b/test-suite/tests/invalid/key-newline.milf index 707aad5..707aad5 100644 --- a/test-suite/tests/invalid/key-newline.toml +++ b/test-suite/tests/invalid/key-newline.milf diff --git a/test-suite/tests/invalid/key-open-bracket.toml b/test-suite/tests/invalid/key-open-bracket.milf index f0aeb16..f0aeb16 100644 --- a/test-suite/tests/invalid/key-open-bracket.toml +++ b/test-suite/tests/invalid/key-open-bracket.milf diff --git a/test-suite/tests/invalid/key-single-open-bracket.toml b/test-suite/tests/invalid/key-single-open-bracket.milf index 8e2f0be..8e2f0be 100644 --- a/test-suite/tests/invalid/key-single-open-bracket.toml +++ b/test-suite/tests/invalid/key-single-open-bracket.milf diff --git a/test-suite/tests/invalid/key-space.toml b/test-suite/tests/invalid/key-space.milf index 201806d..201806d 100644 --- a/test-suite/tests/invalid/key-space.toml +++ b/test-suite/tests/invalid/key-space.milf diff --git a/test-suite/tests/invalid/key-start-bracket.toml b/test-suite/tests/invalid/key-start-bracket.milf index e0597ae..e0597ae 100644 --- a/test-suite/tests/invalid/key-start-bracket.toml +++ b/test-suite/tests/invalid/key-start-bracket.milf diff --git a/test-suite/tests/invalid/key-two-equals.toml b/test-suite/tests/invalid/key-two-equals.milf index 25a0378..25a0378 100644 --- a/test-suite/tests/invalid/key-two-equals.toml +++ b/test-suite/tests/invalid/key-two-equals.milf diff --git a/test-suite/tests/invalid/string-bad-byte-escape.toml b/test-suite/tests/invalid/string-bad-byte-escape.milf index 4c7be59..4c7be59 100644 --- a/test-suite/tests/invalid/string-bad-byte-escape.toml +++ b/test-suite/tests/invalid/string-bad-byte-escape.milf diff --git a/test-suite/tests/invalid/string-bad-escape.toml b/test-suite/tests/invalid/string-bad-escape.milf index 60acb0c..60acb0c 100644 --- a/test-suite/tests/invalid/string-bad-escape.toml +++ b/test-suite/tests/invalid/string-bad-escape.milf diff --git a/test-suite/tests/invalid/string-bad-line-ending-escape.toml b/test-suite/tests/invalid/string-bad-line-ending-escape.milf index 32e2c48..32e2c48 100644 --- a/test-suite/tests/invalid/string-bad-line-ending-escape.toml +++ b/test-suite/tests/invalid/string-bad-line-ending-escape.milf diff --git a/test-suite/tests/invalid/string-byte-escapes.toml b/test-suite/tests/invalid/string-byte-escapes.milf index e94452a..e94452a 100644 --- a/test-suite/tests/invalid/string-byte-escapes.toml +++ b/test-suite/tests/invalid/string-byte-escapes.milf diff --git a/test-suite/tests/invalid/string-no-close.toml b/test-suite/tests/invalid/string-no-close.milf index 0c292fc..0c292fc 100644 --- a/test-suite/tests/invalid/string-no-close.toml +++ b/test-suite/tests/invalid/string-no-close.milf diff --git a/test-suite/tests/invalid/table-array-implicit.toml b/test-suite/tests/invalid/table-array-implicit.milf index 05f2507..a0b4e0c 100644 --- a/test-suite/tests/invalid/table-array-implicit.toml +++ b/test-suite/tests/invalid/table-array-implicit.milf @@ -1,7 +1,7 @@ # This test is a bit tricky. It should fail because the first use of # `[[albums.songs]]` without first declaring `albums` implies that `albums` # must be a table. The alternative would be quite weird. Namely, it wouldn't -# comply with the TOML spec: "Each double-bracketed sub-table will belong to +# comply with the MILF spec: "Each double-bracketed sub-table will belong to # the most *recently* defined table element *above* it." # # This is in contrast to the *valid* test, table-array-implicit where diff --git a/test-suite/tests/invalid/table-array-malformed-bracket.toml b/test-suite/tests/invalid/table-array-malformed-bracket.milf index 39c73b0..39c73b0 100644 --- a/test-suite/tests/invalid/table-array-malformed-bracket.toml +++ b/test-suite/tests/invalid/table-array-malformed-bracket.milf diff --git a/test-suite/tests/invalid/table-array-malformed-empty.toml b/test-suite/tests/invalid/table-array-malformed-empty.milf index a470ca3..a470ca3 100644 --- a/test-suite/tests/invalid/table-array-malformed-empty.toml +++ b/test-suite/tests/invalid/table-array-malformed-empty.milf diff --git a/test-suite/tests/invalid/table-empty.toml b/test-suite/tests/invalid/table-empty.milf index fe51488..fe51488 100644 --- a/test-suite/tests/invalid/table-empty.toml +++ b/test-suite/tests/invalid/table-empty.milf diff --git a/test-suite/tests/invalid/table-nested-brackets-close.toml b/test-suite/tests/invalid/table-nested-brackets-close.milf index c8b5a67..c8b5a67 100644 --- a/test-suite/tests/invalid/table-nested-brackets-close.toml +++ b/test-suite/tests/invalid/table-nested-brackets-close.milf diff --git a/test-suite/tests/invalid/table-nested-brackets-open.toml b/test-suite/tests/invalid/table-nested-brackets-open.milf index 246d7e9..246d7e9 100644 --- a/test-suite/tests/invalid/table-nested-brackets-open.toml +++ b/test-suite/tests/invalid/table-nested-brackets-open.milf diff --git a/test-suite/tests/invalid/table-whitespace.toml b/test-suite/tests/invalid/table-whitespace.milf index 79bbcb1..79bbcb1 100644 --- a/test-suite/tests/invalid/table-whitespace.toml +++ b/test-suite/tests/invalid/table-whitespace.milf diff --git a/test-suite/tests/invalid/table-with-pound.toml b/test-suite/tests/invalid/table-with-pound.milf index 0d8edb5..0d8edb5 100644 --- a/test-suite/tests/invalid/table-with-pound.toml +++ b/test-suite/tests/invalid/table-with-pound.milf diff --git a/test-suite/tests/invalid/text-after-array-entries.toml b/test-suite/tests/invalid/text-after-array-entries.milf index 1a72890..1a72890 100644 --- a/test-suite/tests/invalid/text-after-array-entries.toml +++ b/test-suite/tests/invalid/text-after-array-entries.milf diff --git a/test-suite/tests/invalid/text-after-integer.toml b/test-suite/tests/invalid/text-after-integer.milf index 42de7af..42de7af 100644 --- a/test-suite/tests/invalid/text-after-integer.toml +++ b/test-suite/tests/invalid/text-after-integer.milf diff --git a/test-suite/tests/invalid/text-after-string.toml b/test-suite/tests/invalid/text-after-string.milf index c92a6f1..c92a6f1 100644 --- a/test-suite/tests/invalid/text-after-string.toml +++ b/test-suite/tests/invalid/text-after-string.milf diff --git a/test-suite/tests/invalid/text-after-table.toml b/test-suite/tests/invalid/text-after-table.milf index 87da9db..87da9db 100644 --- a/test-suite/tests/invalid/text-after-table.toml +++ b/test-suite/tests/invalid/text-after-table.milf diff --git a/test-suite/tests/invalid/text-before-array-separator.toml b/test-suite/tests/invalid/text-before-array-separator.milf index 9b06a39..9b06a39 100644 --- a/test-suite/tests/invalid/text-before-array-separator.toml +++ b/test-suite/tests/invalid/text-before-array-separator.milf diff --git a/test-suite/tests/invalid/text-in-array.toml b/test-suite/tests/invalid/text-in-array.milf index a6a6c42..a6a6c42 100644 --- a/test-suite/tests/invalid/text-in-array.toml +++ b/test-suite/tests/invalid/text-in-array.milf diff --git a/test-suite/tests/macros.rs b/test-suite/tests/macros.rs index 20831a0..3cc5e81 100644 --- a/test-suite/tests/macros.rs +++ b/test-suite/tests/macros.rs @@ -1,7 +1,7 @@ #![recursion_limit = "256"] #[macro_use] -extern crate toml; +extern crate milf; use std::f64; @@ -9,11 +9,11 @@ macro_rules! table { ($($key:expr => $value:expr,)*) => {{ // https://github.com/rust-lang/rust/issues/60643 #[allow(unused_mut)] - let mut table = toml::value::Table::new(); + let mut table = milf::value::Table::new(); $( table.insert($key.to_string(), $value.into()); )* - toml::Value::Table(table) + milf::Value::Table(table) }}; } @@ -21,22 +21,22 @@ macro_rules! array { ($($element:expr,)*) => {{ // https://github.com/rust-lang/rust/issues/60643 #[allow(unused_mut)] - let mut array = toml::value::Array::new(); + let mut array = milf::value::Array::new(); $( array.push($element.into()); )* - toml::Value::Array(array) + milf::Value::Array(array) }}; } macro_rules! datetime { ($s:tt) => { - $s.parse::<toml::value::Datetime>().unwrap() + $s.parse::<milf::value::Datetime>().unwrap() }; } #[test] -fn test_cargo_toml() { +fn test_cargo_milf() { // Simple sanity check of: // // - Ordinary tables @@ -45,9 +45,9 @@ fn test_cargo_toml() { // - String values // - Table keys containing hyphen // - Table headers containing hyphen - let actual = toml! { + let actual = milf! { [package] - name = "toml" + name = "milf" version = "0.4.5" authors = ["Alex Crichton <alex@alexcrichton.com>"] @@ -64,7 +64,7 @@ fn test_cargo_toml() { let expected = table! { "package" => table! { - "name" => "toml".to_owned(), + "name" => "milf".to_owned(), "version" => "0.4.5".to_owned(), "authors" => array! { "Alex Crichton <alex@alexcrichton.com>".to_owned(), @@ -89,8 +89,8 @@ fn test_cargo_toml() { #[test] fn test_array() { - // Copied from the TOML spec. - let actual = toml! { + // Copied from the MILF spec. + let actual = milf! { [[fruit]] name = "apple" @@ -144,7 +144,7 @@ fn test_array() { #[test] fn test_number() { - let actual = toml! { + let actual = milf! { positive = 1 negative = -1 table = { positive = 1, negative = -1 } @@ -193,7 +193,7 @@ fn test_number() { #[test] fn test_nan() { - let actual = toml! { + let actual = milf! { sf4 = nan sf5 = +nan sf6 = -nan @@ -205,8 +205,8 @@ fn test_nan() { #[test] fn test_datetime() { - let actual = toml! { - // Copied from the TOML spec. + let actual = milf! { + // Copied from the MILF spec. odt1 = 1979-05-27T07:32:00Z odt2 = 1979-05-27T00:32:00-07:00 odt3 = 1979-05-27T00:32:00.999999-07:00 @@ -284,7 +284,7 @@ fn test_datetime() { // This test requires rustc >= 1.20. #[test] fn test_quoted_key() { - let actual = toml! { + let actual = milf! { "quoted" = true table = { "quoted" = true } @@ -311,7 +311,7 @@ fn test_quoted_key() { #[test] fn test_empty() { - let actual = toml! { + let actual = milf! { empty_inline_table = {} empty_inline_array = [] @@ -334,7 +334,7 @@ fn test_empty() { #[test] fn test_dotted_keys() { - let actual = toml! { + let actual = milf! { a.b = 123 a.c = 1979-05-27T07:32:00Z [table] diff --git a/test-suite/tests/parser.rs b/test-suite/tests/parser.rs index 169df79..0d14803 100644 --- a/test-suite/tests/parser.rs +++ b/test-suite/tests/parser.rs @@ -1,10 +1,10 @@ -extern crate toml; +extern crate milf; -use toml::Value; +use milf::Value; macro_rules! bad { - ($toml:expr, $msg:expr) => { - match $toml.parse::<toml::Value>() { + ($milf:expr, $msg:expr) => { + match $milf.parse::<milf::Value>() { Ok(s) => panic!("parsed to: {:#?}", s), Err(e) => assert_eq!(e.to_string(), $msg), } @@ -493,7 +493,7 @@ fn bad_underscores() { bad!("foo = 0__0", "invalid number at line 1 column 7"); bad!( "foo = __0", - "invalid TOML value, did you mean to use a quoted string? at line 1 column 7" + "invalid MILF value, did you mean to use a quoted string? at line 1 column 7" ); bad!("foo = 1_0_", "invalid number at line 1 column 7"); } @@ -540,19 +540,19 @@ fn booleans() { bad!( "foo = true2", - "invalid TOML value, did you mean to use a quoted string? at line 1 column 7" + "invalid MILF value, did you mean to use a quoted string? at line 1 column 7" ); bad!( "foo = false2", - "invalid TOML value, did you mean to use a quoted string? at line 1 column 7" + "invalid MILF value, did you mean to use a quoted string? at line 1 column 7" ); bad!( "foo = t1", - "invalid TOML value, did you mean to use a quoted string? at line 1 column 7" + "invalid MILF value, did you mean to use a quoted string? at line 1 column 7" ); bad!( "foo = f2", - "invalid TOML value, did you mean to use a quoted string? at line 1 column 7" + "invalid MILF value, did you mean to use a quoted string? at line 1 column 7" ); } @@ -643,8 +643,8 @@ fn datetimes() { macro_rules! t { ($actual:expr) => {{ let f = format!("foo = {}", $actual); - let toml = f.parse::<Value>().expect(&format!("failed: {}", f)); - assert_eq!(toml["foo"].as_datetime().unwrap().to_string(), $actual); + let milf = f.parse::<Value>().expect(&format!("failed: {}", f)); + assert_eq!(milf["foo"].as_datetime().unwrap().to_string(), $actual); }}; } diff --git a/test-suite/tests/pretty.rs b/test-suite/tests/pretty.rs index 0c65e0f..ee9f4f8 100644 --- a/test-suite/tests/pretty.rs +++ b/test-suite/tests/pretty.rs @@ -1,5 +1,5 @@ extern crate serde; -extern crate toml; +extern crate milf; use serde::ser::Serialize; @@ -13,31 +13,31 @@ text = \"\\nthis is the first line\\nthis is the second line\\n\" #[test] fn no_pretty() { - let toml = NO_PRETTY; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = NO_PRETTY; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); value - .serialize(&mut toml::Serializer::new(&mut result)) + .serialize(&mut milf::Serializer::new(&mut result)) .unwrap(); - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } #[test] fn disable_pretty() { - let toml = NO_PRETTY; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = NO_PRETTY; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::pretty(&mut result); + let mut serializer = milf::Serializer::pretty(&mut result); serializer.pretty_string(false); serializer.pretty_array(false); value.serialize(&mut serializer).unwrap(); } - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_STD: &'static str = "\ @@ -57,15 +57,15 @@ this is the second line #[test] fn pretty_std() { - let toml = PRETTY_STD; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_STD; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); value - .serialize(&mut toml::Serializer::pretty(&mut result)) + .serialize(&mut milf::Serializer::pretty(&mut result)) .unwrap(); - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_INDENT_2: &'static str = "\ @@ -90,16 +90,16 @@ three = [ #[test] fn pretty_indent_2() { - let toml = PRETTY_INDENT_2; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_INDENT_2; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::pretty(&mut result); + let mut serializer = milf::Serializer::pretty(&mut result); serializer.pretty_array_indent(2); value.serialize(&mut serializer).unwrap(); } println!(">> Result:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_INDENT_2_OTHER: &'static str = "\ @@ -116,15 +116,15 @@ text = \"\\nthis is the first line\\nthis is the second line\\n\" #[test] /// Test pretty indent when gotten the other way fn pretty_indent_2_other() { - let toml = PRETTY_INDENT_2_OTHER; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_INDENT_2_OTHER; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::new(&mut result); + let mut serializer = milf::Serializer::new(&mut result); serializer.pretty_array_indent(2); value.serialize(&mut serializer).unwrap(); } - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_ARRAY_NO_COMMA: &'static str = "\ @@ -140,15 +140,15 @@ text = \"\\nthis is the first line\\nthis is the second line\\n\" #[test] /// Test pretty indent when gotten the other way fn pretty_indent_array_no_comma() { - let toml = PRETTY_ARRAY_NO_COMMA; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_ARRAY_NO_COMMA; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::new(&mut result); + let mut serializer = milf::Serializer::new(&mut result); serializer.pretty_array_trailing_comma(false); value.serialize(&mut serializer).unwrap(); } - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_NO_STRING: &'static str = "\ @@ -164,15 +164,15 @@ text = \"\\nthis is the first line\\nthis is the second line\\n\" #[test] /// Test pretty indent when gotten the other way fn pretty_no_string() { - let toml = PRETTY_NO_STRING; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_NO_STRING; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::pretty(&mut result); + let mut serializer = milf::Serializer::pretty(&mut result); serializer.pretty_string(false); value.serialize(&mut serializer).unwrap(); } - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_TRICKY: &'static str = r##"[example] @@ -204,15 +204,15 @@ this is the fourth line #[test] fn pretty_tricky() { - let toml = PRETTY_TRICKY; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_TRICKY; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); value - .serialize(&mut toml::Serializer::pretty(&mut result)) + .serialize(&mut milf::Serializer::pretty(&mut result)) .unwrap(); - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_TABLE_ARRAY: &'static str = r##"[[array]] @@ -230,15 +230,15 @@ single = 'this is a single line string' #[test] fn pretty_table_array() { - let toml = PRETTY_TABLE_ARRAY; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_TABLE_ARRAY; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); value - .serialize(&mut toml::Serializer::pretty(&mut result)) + .serialize(&mut milf::Serializer::pretty(&mut result)) .unwrap(); - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const TABLE_ARRAY: &'static str = r##"[[array]] @@ -256,15 +256,15 @@ single = "this is a single line string" #[test] fn table_array() { - let toml = TABLE_ARRAY; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = TABLE_ARRAY; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); value - .serialize(&mut toml::Serializer::new(&mut result)) + .serialize(&mut milf::Serializer::new(&mut result)) .unwrap(); - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } const PRETTY_TRICKY_NON_LITERAL: &'static str = r##"[example] @@ -300,15 +300,15 @@ this is the fourth line #[test] fn pretty_tricky_non_literal() { - let toml = PRETTY_TRICKY_NON_LITERAL; - let value: toml::Value = toml::from_str(toml).unwrap(); + let milf = PRETTY_TRICKY_NON_LITERAL; + let value: milf::Value = milf::from_str(milf).unwrap(); let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::pretty(&mut result); + let mut serializer = milf::Serializer::pretty(&mut result); serializer.pretty_string_literal(false); value.serialize(&mut serializer).unwrap(); } - println!("EXPECTED:\n{}", toml); + println!("EXPECTED:\n{}", milf); println!("\nRESULT:\n{}", result); - assert_eq!(toml, &result); + assert_eq!(milf, &result); } diff --git a/test-suite/tests/serde.rs b/test-suite/tests/serde.rs index 56172bd..712d2c5 100644 --- a/test-suite/tests/serde.rs +++ b/test-suite/tests/serde.rs @@ -1,15 +1,15 @@ extern crate serde; extern crate serde_json; -extern crate toml; +extern crate milf; #[macro_use] extern crate serde_derive; use serde::{Deserialize, Deserializer}; use std::collections::{BTreeMap, HashSet}; -use toml::map::Map; -use toml::Value; -use toml::Value::{Array, Float, Integer, Table}; +use milf::map::Map; +use milf::Value; +use milf::Value::{Array, Float, Integer, Table}; macro_rules! t { ($e:expr) => { @@ -21,38 +21,38 @@ macro_rules! t { } macro_rules! equivalent { - ($literal:expr, $toml:expr,) => {{ - let toml = $toml; + ($literal:expr, $milf:expr,) => {{ + let milf = $milf; let literal = $literal; // In/out of Value is equivalent println!("try_from"); - assert_eq!(t!(Value::try_from(literal.clone())), toml); + assert_eq!(t!(Value::try_from(literal.clone())), milf); println!("try_into"); - assert_eq!(literal, t!(toml.clone().try_into())); + assert_eq!(literal, t!(milf.clone().try_into())); // Through a string equivalent println!("to_string(literal)"); - assert_eq!(t!(toml::to_string(&literal)), toml.to_string()); - println!("to_string(toml)"); - assert_eq!(t!(toml::to_string(&toml)), toml.to_string()); - println!("literal, from_str(toml)"); - assert_eq!(literal, t!(toml::from_str(&toml.to_string()))); - println!("toml, from_str(toml)"); - assert_eq!(toml, t!(toml::from_str(&toml.to_string()))); + assert_eq!(t!(milf::to_string(&literal)), milf.to_string()); + println!("to_string(milf)"); + assert_eq!(t!(milf::to_string(&milf)), milf.to_string()); + println!("literal, from_str(milf)"); + assert_eq!(literal, t!(milf::from_str(&milf.to_string()))); + println!("milf, from_str(milf)"); + assert_eq!(milf, t!(milf::from_str(&milf.to_string()))); }}; } macro_rules! error { - ($ty:ty, $toml:expr, $msg_parse:expr, $msg_decode:expr) => {{ + ($ty:ty, $milf:expr, $msg_parse:expr, $msg_decode:expr) => {{ println!("attempting parsing"); - match toml::from_str::<$ty>(&$toml.to_string()) { + match milf::from_str::<$ty>(&$milf.to_string()) { Ok(_) => panic!("successful"), Err(e) => assert_eq!(e.to_string(), $msg_parse), } - println!("attempting toml decoding"); - match $toml.try_into::<$ty>() { + println!("attempting milf decoding"); + match $milf.try_into::<$ty>() { Ok(_) => panic!("successful"), Err(e) => assert_eq!(e.to_string(), $msg_decode), } @@ -376,7 +376,7 @@ fn parse_enum_string() { // })); // assert_eq!(v, t!(Deserialize::deserialize(&mut d))); // -// assert_eq!(d.toml, Some(Table(map! { +// assert_eq!(d.milf, Some(Table(map! { // b, Integer(5) // }))); // } @@ -397,7 +397,7 @@ fn parse_enum_string() { // })); // assert_eq!(v, t!(Deserialize::deserialize(&mut d))); // -// assert_eq!(d.toml, Some(Table(map! { +// assert_eq!(d.milf, Some(Table(map! { // a, Table(map! { // b, Integer(5) // }) @@ -419,7 +419,7 @@ fn parse_enum_string() { // })); // assert_eq!(v, t!(Deserialize::deserialize(&mut d))); // -// assert_eq!(d.toml, None); +// assert_eq!(d.milf, None); // } // // #[test] @@ -435,7 +435,7 @@ fn parse_enum_string() { // })); // assert_eq!(v, t!(Deserialize::deserialize(&mut d))); // -// assert_eq!(d.toml, None); +// assert_eq!(d.milf, None); // } // // #[test] @@ -449,7 +449,7 @@ fn parse_enum_string() { // })); // assert_eq!(v, t!(Deserialize::deserialize(&mut d))); // -// assert_eq!(d.toml, None); +// assert_eq!(d.milf, None); // } // // #[test] @@ -463,7 +463,7 @@ fn parse_enum_string() { // })); // assert_eq!(v, t!(Deserialize::deserialize(&mut d))); // -// assert_eq!(d.toml, None); +// assert_eq!(d.milf, None); // } // // #[test] @@ -482,7 +482,7 @@ fn parse_enum_string() { // })); // assert_eq!(v, t!(Deserialize::deserialize(&mut d))); // -// assert_eq!(d.toml, Some(Table(map! { +// assert_eq!(d.milf, Some(Table(map! { // a, Array(vec![Table(map! { // b, Integer(2) // })]) @@ -531,9 +531,9 @@ fn extra_keys() { a: isize, } - let toml = Table(map! { a: Integer(2), b: Integer(2) }); - assert!(toml.clone().try_into::<Foo>().is_ok()); - assert!(toml::from_str::<Foo>(&toml.to_string()).is_ok()); + let milf = Table(map! { a: Integer(2), b: Integer(2) }); + assert!(milf.clone().try_into::<Foo>().is_ok()); + assert!(milf::from_str::<Foo>(&milf.to_string()).is_ok()); } #[test] @@ -590,7 +590,7 @@ struct CanBeEmpty { #[test] fn table_structs_empty() { let text = "[bar]\n\n[baz]\n\n[bazv]\na = \"foo\"\n\n[foo]\n"; - let value: BTreeMap<String, CanBeEmpty> = toml::from_str(text).unwrap(); + let value: BTreeMap<String, CanBeEmpty> = milf::from_str(text).unwrap(); let mut expected: BTreeMap<String, CanBeEmpty> = BTreeMap::new(); expected.insert("bar".to_string(), CanBeEmpty::default()); expected.insert("baz".to_string(), CanBeEmpty::default()); @@ -603,7 +603,7 @@ fn table_structs_empty() { ); expected.insert("foo".to_string(), CanBeEmpty::default()); assert_eq!(value, expected); - assert_eq!(toml::to_string(&value).unwrap(), text); + assert_eq!(milf::to_string(&value).unwrap(), text); } #[test] @@ -671,7 +671,7 @@ fn homogeneous_tuple_struct() { fn json_interoperability() { #[derive(Serialize, Deserialize)] struct Foo { - any: toml::Value, + any: milf::Value, } let _foo: Foo = serde_json::from_str( diff --git a/test-suite/tests/spanned-impls.rs b/test-suite/tests/spanned-impls.rs index cb12b1a..eb95673 100644 --- a/test-suite/tests/spanned-impls.rs +++ b/test-suite/tests/spanned-impls.rs @@ -1,5 +1,5 @@ use std::cmp::{Ord, Ordering, PartialOrd}; -use toml::{from_str, Spanned}; +use milf::{from_str, Spanned}; #[macro_use] extern crate serde_derive; diff --git a/test-suite/tests/spanned.rs b/test-suite/tests/spanned.rs index d8f7a12..a8d29d4 100644 --- a/test-suite/tests/spanned.rs +++ b/test-suite/tests/spanned.rs @@ -1,12 +1,12 @@ extern crate serde; -extern crate toml; +extern crate milf; #[macro_use] extern crate serde_derive; use std::collections::HashMap; use std::fmt::Debug; -use toml::value::Datetime; -use toml::Spanned; +use milf::value::Datetime; +use milf::Spanned; /// A set of good datetimes. pub fn good_datetimes() -> Vec<&'static str> { @@ -41,7 +41,7 @@ fn test_spanned_field() { where T: serde::Deserialize<'de> + Debug + PartialEq, { - let foo: Foo<T> = toml::from_str(s).unwrap(); + let foo: Foo<T> = milf::from_str(s).unwrap(); assert_eq!(6, foo.foo.start()); if let Some(end) = end { @@ -52,7 +52,7 @@ fn test_spanned_field() { assert_eq!(expected, &s[foo.foo.start()..foo.foo.end()]); // Test for Spanned<> at the top level - let foo_outer: Spanned<BareFoo<T>> = toml::from_str(s).unwrap(); + let foo_outer: Spanned<BareFoo<T>> = milf::from_str(s).unwrap(); assert_eq!(0, foo_outer.start()); assert_eq!(s.len(), foo_outer.end()); @@ -94,13 +94,13 @@ fn test_inner_spanned_table() { } fn good(s: &str, zero: bool) { - let foo: Foo = toml::from_str(s).unwrap(); + let foo: Foo = milf::from_str(s).unwrap(); if zero { assert_eq!(foo.foo.start(), 0); // We'd actually have to assert equality with s.len() here, // but the current implementation doesn't support that, - // and it's not possible with toml's data format to support it + // and it's not possible with milf's data format to support it // in the general case as spans aren't always well-defined. // So this check mainly serves as a reminder that this test should // be updated *if* one day there is support for emitting the actual span. @@ -141,7 +141,7 @@ fn test_outer_spanned_table() { } fn good(s: &str) { - let foo: Foo = toml::from_str(s).unwrap(); + let foo: Foo = milf::from_str(s).unwrap(); for (k, v) in foo.foo.iter() { assert_eq!(&s[k.start()..k.end()], k.get_ref()); @@ -174,7 +174,7 @@ fn test_spanned_nested() { } fn good(s: &str) { - let foo: Foo = toml::from_str(s).unwrap(); + let foo: Foo = milf::from_str(s).unwrap(); for (k, v) in foo.foo.iter() { assert_eq!(&s[k.start()..k.end()], k.get_ref()); @@ -214,13 +214,13 @@ fn test_spanned_array() { } fn good(s: &str) { - let foo_list: Foo = toml::from_str(s).unwrap(); + let foo_list: Foo = milf::from_str(s).unwrap(); for foo in foo_list.foo.iter() { assert_eq!(foo.start(), 0); // We'd actually have to assert equality with s.len() here, // but the current implementation doesn't support that, - // and it's not possible with toml's data format to support it + // and it's not possible with milf's data format to support it // in the general case as spans aren't always well-defined. // So this check mainly serves as a reminder that this test should // be updated *if* one day there is support for emitting the actual span. diff --git a/test-suite/tests/tables-last.rs b/test-suite/tests/tables-last.rs index b885a42..ae427e4 100644 --- a/test-suite/tests/tables-last.rs +++ b/test-suite/tests/tables-last.rs @@ -1,12 +1,12 @@ #[macro_use] extern crate serde_derive; -extern crate toml; +extern crate milf; use std::collections::HashMap; #[derive(Serialize)] struct A { - #[serde(serialize_with = "toml::ser::tables_last")] + #[serde(serialize_with = "milf::ser::tables_last")] vals: HashMap<&'static str, Value>, } @@ -28,5 +28,5 @@ fn always_works() { sub.insert("foo", "bar"); a.vals.insert("bar", Value::Map(sub)); - toml::to_string(&a).unwrap(); + milf::to_string(&a).unwrap(); } diff --git a/test-suite/tests/valid.rs b/test-suite/tests/valid.rs index 0745cc8..ddbaf1b 100644 --- a/test-suite/tests/valid.rs +++ b/test-suite/tests/valid.rs @@ -1,12 +1,12 @@ extern crate serde; extern crate serde_json; -extern crate toml; +extern crate milf; use serde::ser::Serialize; use serde_json::Value as Json; -use toml::{to_string_pretty, Value as Toml}; +use milf::{to_string_pretty, Value as Milf}; -fn to_json(toml: toml::Value) -> Json { +fn to_json(milf: milf::Value) -> Json { fn doit(s: &str, json: Json) -> Json { let mut map = serde_json::Map::new(); map.insert("type".to_string(), Json::String(s.to_string())); @@ -14,10 +14,10 @@ fn to_json(toml: toml::Value) -> Json { Json::Object(map) } - match toml { - Toml::String(s) => doit("string", Json::String(s)), - Toml::Integer(i) => doit("integer", Json::String(i.to_string())), - Toml::Float(f) => doit( + match milf { + Milf::String(s) => doit("string", Json::String(s)), + Milf::Integer(i) => doit("integer", Json::String(i.to_string())), + Milf::Float(f) => doit( "float", Json::String({ let s = format!("{:.15}", f); @@ -29,11 +29,11 @@ fn to_json(toml: toml::Value) -> Json { } }), ), - Toml::Boolean(b) => doit("bool", Json::String(format!("{}", b))), - Toml::Datetime(s) => doit("datetime", Json::String(s.to_string())), - Toml::Array(arr) => { + Milf::Boolean(b) => doit("bool", Json::String(format!("{}", b))), + Milf::Datetime(s) => doit("datetime", Json::String(s.to_string())), + Milf::Array(arr) => { let is_table = match arr.first() { - Some(&Toml::Table(..)) => true, + Some(&Milf::Table(..)) => true, _ => false, }; let json = Json::Array(arr.into_iter().map(to_json).collect()); @@ -43,7 +43,7 @@ fn to_json(toml: toml::Value) -> Json { doit("array", json) } } - Toml::Table(table) => { + Milf::Table(table) => { let mut map = serde_json::Map::new(); for (k, v) in table { map.insert(k, to_json(v)); @@ -53,345 +53,345 @@ fn to_json(toml: toml::Value) -> Json { } } -fn run_pretty(toml: Toml) { - // Assert toml == json +fn run_pretty(milf: Milf) { + // Assert milf == json println!("### pretty round trip parse."); // standard pretty - let toml_raw = to_string_pretty(&toml).expect("to string"); - let toml2 = toml_raw.parse().expect("from string"); - assert_eq!(toml, toml2); + let milf_raw = to_string_pretty(&milf).expect("to string"); + let milf2 = milf_raw.parse().expect("from string"); + assert_eq!(milf, milf2); // pretty with indent 2 let mut result = String::with_capacity(128); { - let mut serializer = toml::Serializer::pretty(&mut result); + let mut serializer = milf::Serializer::pretty(&mut result); serializer.pretty_array_indent(2); - toml.serialize(&mut serializer).expect("to string"); + milf.serialize(&mut serializer).expect("to string"); } - assert_eq!(toml, result.parse().expect("from str")); + assert_eq!(milf, result.parse().expect("from str")); result.clear(); { - let mut serializer = toml::Serializer::new(&mut result); + let mut serializer = milf::Serializer::new(&mut result); serializer.pretty_array_trailing_comma(false); - toml.serialize(&mut serializer).expect("to string"); + milf.serialize(&mut serializer).expect("to string"); } - assert_eq!(toml, result.parse().expect("from str")); + assert_eq!(milf, result.parse().expect("from str")); result.clear(); { - let mut serializer = toml::Serializer::pretty(&mut result); + let mut serializer = milf::Serializer::pretty(&mut result); serializer.pretty_string(false); - toml.serialize(&mut serializer).expect("to string"); - assert_eq!(toml, toml2); + milf.serialize(&mut serializer).expect("to string"); + assert_eq!(milf, milf2); } - assert_eq!(toml, result.parse().expect("from str")); + assert_eq!(milf, result.parse().expect("from str")); result.clear(); { - let mut serializer = toml::Serializer::pretty(&mut result); + let mut serializer = milf::Serializer::pretty(&mut result); serializer.pretty_array(false); - toml.serialize(&mut serializer).expect("to string"); - assert_eq!(toml, toml2); + milf.serialize(&mut serializer).expect("to string"); + assert_eq!(milf, milf2); } - assert_eq!(toml, result.parse().expect("from str")); + assert_eq!(milf, result.parse().expect("from str")); } -fn run(toml_raw: &str, json_raw: &str) { - println!("parsing:\n{}", toml_raw); - let toml: Toml = toml_raw.parse().unwrap(); +fn run(milf_raw: &str, json_raw: &str) { + println!("parsing:\n{}", milf_raw); + let milf: Milf = milf_raw.parse().unwrap(); let json: Json = json_raw.parse().unwrap(); - // Assert toml == json - let toml_json = to_json(toml.clone()); + // Assert milf == json + let milf_json = to_json(milf.clone()); assert!( - json == toml_json, + json == milf_json, "expected\n{}\ngot\n{}\n", serde_json::to_string_pretty(&json).unwrap(), - serde_json::to_string_pretty(&toml_json).unwrap() + serde_json::to_string_pretty(&milf_json).unwrap() ); // Assert round trip - println!("round trip parse: {}", toml); - let toml2 = toml.to_string().parse().unwrap(); - assert_eq!(toml, toml2); - run_pretty(toml); + println!("round trip parse: {}", milf); + let milf2 = milf.to_string().parse().unwrap(); + assert_eq!(milf, milf2); + run_pretty(milf); } -macro_rules! test( ($name:ident, $toml:expr, $json:expr) => ( +macro_rules! test( ($name:ident, $milf:expr, $json:expr) => ( #[test] - fn $name() { run($toml, $json); } + fn $name() { run($milf, $json); } ) ); test!( array_empty, - include_str!("valid/array-empty.toml"), + include_str!("valid/array-empty.milf"), include_str!("valid/array-empty.json") ); test!( array_nospaces, - include_str!("valid/array-nospaces.toml"), + include_str!("valid/array-nospaces.milf"), include_str!("valid/array-nospaces.json") ); test!( arrays_hetergeneous, - include_str!("valid/arrays-hetergeneous.toml"), + include_str!("valid/arrays-hetergeneous.milf"), include_str!("valid/arrays-hetergeneous.json") ); test!( arrays, - include_str!("valid/arrays.toml"), + include_str!("valid/arrays.milf"), include_str!("valid/arrays.json") ); test!( arrays_nested, - include_str!("valid/arrays-nested.toml"), + include_str!("valid/arrays-nested.milf"), include_str!("valid/arrays-nested.json") ); test!( array_mixed_types_ints_and_floats, - include_str!("valid/array-mixed-types-ints-and-floats.toml"), + include_str!("valid/array-mixed-types-ints-and-floats.milf"), include_str!("valid/array-mixed-types-ints-and-floats.json") ); test!( array_mixed_types_arrays_and_ints, - include_str!("valid/array-mixed-types-arrays-and-ints.toml"), + include_str!("valid/array-mixed-types-arrays-and-ints.milf"), include_str!("valid/array-mixed-types-arrays-and-ints.json") ); test!( array_mixed_types_strings_and_ints, - include_str!("valid/array-mixed-types-strings-and-ints.toml"), + include_str!("valid/array-mixed-types-strings-and-ints.milf"), include_str!("valid/array-mixed-types-strings-and-ints.json") ); test!( empty, - include_str!("valid/empty.toml"), + include_str!("valid/empty.milf"), include_str!("valid/empty.json") ); test!( bool, - include_str!("valid/bool.toml"), + include_str!("valid/bool.milf"), include_str!("valid/bool.json") ); test!( comments_everywhere, - include_str!("valid/comments-everywhere.toml"), + include_str!("valid/comments-everywhere.milf"), include_str!("valid/comments-everywhere.json") ); test!( datetime, - include_str!("valid/datetime.toml"), + include_str!("valid/datetime.milf"), include_str!("valid/datetime.json") ); test!( example, - include_str!("valid/example.toml"), + include_str!("valid/example.milf"), include_str!("valid/example.json") ); test!( float, - include_str!("valid/float.toml"), + include_str!("valid/float.milf"), include_str!("valid/float.json") ); test!( implicit_and_explicit_after, - include_str!("valid/implicit-and-explicit-after.toml"), + include_str!("valid/implicit-and-explicit-after.milf"), include_str!("valid/implicit-and-explicit-after.json") ); test!( implicit_and_explicit_before, - include_str!("valid/implicit-and-explicit-before.toml"), + include_str!("valid/implicit-and-explicit-before.milf"), include_str!("valid/implicit-and-explicit-before.json") ); test!( implicit_groups, - include_str!("valid/implicit-groups.toml"), + include_str!("valid/implicit-groups.milf"), include_str!("valid/implicit-groups.json") ); test!( integer, - include_str!("valid/integer.toml"), + include_str!("valid/integer.milf"), include_str!("valid/integer.json") ); test!( key_equals_nospace, - include_str!("valid/key-equals-nospace.toml"), + include_str!("valid/key-equals-nospace.milf"), include_str!("valid/key-equals-nospace.json") ); test!( key_space, - include_str!("valid/key-space.toml"), + include_str!("valid/key-space.milf"), include_str!("valid/key-space.json") ); test!( key_special_chars, - include_str!("valid/key-special-chars.toml"), + include_str!("valid/key-special-chars.milf"), include_str!("valid/key-special-chars.json") ); test!( key_with_pound, - include_str!("valid/key-with-pound.toml"), + include_str!("valid/key-with-pound.milf"), include_str!("valid/key-with-pound.json") ); test!( long_float, - include_str!("valid/long-float.toml"), + include_str!("valid/long-float.milf"), include_str!("valid/long-float.json") ); test!( long_integer, - include_str!("valid/long-integer.toml"), + include_str!("valid/long-integer.milf"), include_str!("valid/long-integer.json") ); test!( multiline_string, - include_str!("valid/multiline-string.toml"), + include_str!("valid/multiline-string.milf"), include_str!("valid/multiline-string.json") ); test!( raw_multiline_string, - include_str!("valid/raw-multiline-string.toml"), + include_str!("valid/raw-multiline-string.milf"), include_str!("valid/raw-multiline-string.json") ); test!( raw_string, - include_str!("valid/raw-string.toml"), + include_str!("valid/raw-string.milf"), include_str!("valid/raw-string.json") ); test!( string_empty, - include_str!("valid/string-empty.toml"), + include_str!("valid/string-empty.milf"), include_str!("valid/string-empty.json") ); test!( string_escapes, - include_str!("valid/string-escapes.toml"), + include_str!("valid/string-escapes.milf"), include_str!("valid/string-escapes.json") ); test!( string_simple, - include_str!("valid/string-simple.toml"), + include_str!("valid/string-simple.milf"), include_str!("valid/string-simple.json") ); test!( string_with_pound, - include_str!("valid/string-with-pound.toml"), + include_str!("valid/string-with-pound.milf"), include_str!("valid/string-with-pound.json") ); test!( table_array_implicit, - include_str!("valid/table-array-implicit.toml"), + include_str!("valid/table-array-implicit.milf"), include_str!("valid/table-array-implicit.json") ); test!( table_array_many, - include_str!("valid/table-array-many.toml"), + include_str!("valid/table-array-many.milf"), include_str!("valid/table-array-many.json") ); test!( table_array_nest, - include_str!("valid/table-array-nest.toml"), + include_str!("valid/table-array-nest.milf"), include_str!("valid/table-array-nest.json") ); test!( table_array_one, - include_str!("valid/table-array-one.toml"), + include_str!("valid/table-array-one.milf"), include_str!("valid/table-array-one.json") ); test!( table_empty, - include_str!("valid/table-empty.toml"), + include_str!("valid/table-empty.milf"), include_str!("valid/table-empty.json") ); test!( table_sub_empty, - include_str!("valid/table-sub-empty.toml"), + include_str!("valid/table-sub-empty.milf"), include_str!("valid/table-sub-empty.json") ); test!( table_multi_empty, - include_str!("valid/table-multi-empty.toml"), + include_str!("valid/table-multi-empty.milf"), include_str!("valid/table-multi-empty.json") ); test!( table_whitespace, - include_str!("valid/table-whitespace.toml"), + include_str!("valid/table-whitespace.milf"), include_str!("valid/table-whitespace.json") ); test!( table_with_pound, - include_str!("valid/table-with-pound.toml"), + include_str!("valid/table-with-pound.milf"), include_str!("valid/table-with-pound.json") ); test!( unicode_escape, - include_str!("valid/unicode-escape.toml"), + include_str!("valid/unicode-escape.milf"), include_str!("valid/unicode-escape.json") ); test!( unicode_literal, - include_str!("valid/unicode-literal.toml"), + include_str!("valid/unicode-literal.milf"), include_str!("valid/unicode-literal.json") ); test!( hard_example, - include_str!("valid/hard_example.toml"), + include_str!("valid/hard_example.milf"), include_str!("valid/hard_example.json") ); test!( example2, - include_str!("valid/example2.toml"), + include_str!("valid/example2.milf"), include_str!("valid/example2.json") ); test!( example3, - include_str!("valid/example-v0.3.0.toml"), + include_str!("valid/example-v0.3.0.milf"), include_str!("valid/example-v0.3.0.json") ); test!( example4, - include_str!("valid/example-v0.4.0.toml"), + include_str!("valid/example-v0.4.0.milf"), include_str!("valid/example-v0.4.0.json") ); test!( example_bom, - include_str!("valid/example-bom.toml"), + include_str!("valid/example-bom.milf"), include_str!("valid/example.json") ); test!( datetime_truncate, - include_str!("valid/datetime-truncate.toml"), + include_str!("valid/datetime-truncate.milf"), include_str!("valid/datetime-truncate.json") ); test!( key_quote_newline, - include_str!("valid/key-quote-newline.toml"), + include_str!("valid/key-quote-newline.milf"), include_str!("valid/key-quote-newline.json") ); test!( table_array_nest_no_keys, - include_str!("valid/table-array-nest-no-keys.toml"), + include_str!("valid/table-array-nest-no-keys.milf"), include_str!("valid/table-array-nest-no-keys.json") ); test!( dotted_keys, - include_str!("valid/dotted-keys.toml"), + include_str!("valid/dotted-keys.milf"), include_str!("valid/dotted-keys.json") ); test!( quote_surrounded_value, - include_str!("valid/quote-surrounded-value.toml"), + include_str!("valid/quote-surrounded-value.milf"), include_str!("valid/quote-surrounded-value.json") ); test!( float_exponent, - include_str!("valid/float-exponent.toml"), + include_str!("valid/float-exponent.milf"), include_str!("valid/float-exponent.json") ); test!( string_delim_end, - include_str!("valid/string-delim-end.toml"), + include_str!("valid/string-delim-end.milf"), include_str!("valid/string-delim-end.json") ); diff --git a/test-suite/tests/valid/array-empty.toml b/test-suite/tests/valid/array-empty.milf index fa58dc6..fa58dc6 100644 --- a/test-suite/tests/valid/array-empty.toml +++ b/test-suite/tests/valid/array-empty.milf diff --git a/test-suite/tests/valid/array-mixed-types-arrays-and-ints.toml b/test-suite/tests/valid/array-mixed-types-arrays-and-ints.milf index 051ec73..051ec73 100644 --- a/test-suite/tests/valid/array-mixed-types-arrays-and-ints.toml +++ b/test-suite/tests/valid/array-mixed-types-arrays-and-ints.milf diff --git a/test-suite/tests/valid/array-mixed-types-ints-and-floats.toml b/test-suite/tests/valid/array-mixed-types-ints-and-floats.milf index a5aa9b7..a5aa9b7 100644 --- a/test-suite/tests/valid/array-mixed-types-ints-and-floats.toml +++ b/test-suite/tests/valid/array-mixed-types-ints-and-floats.milf diff --git a/test-suite/tests/valid/array-mixed-types-strings-and-ints.toml b/test-suite/tests/valid/array-mixed-types-strings-and-ints.milf index f348308..f348308 100644 --- a/test-suite/tests/valid/array-mixed-types-strings-and-ints.toml +++ b/test-suite/tests/valid/array-mixed-types-strings-and-ints.milf diff --git a/test-suite/tests/valid/array-nospaces.toml b/test-suite/tests/valid/array-nospaces.milf index 6618936..6618936 100644 --- a/test-suite/tests/valid/array-nospaces.toml +++ b/test-suite/tests/valid/array-nospaces.milf diff --git a/test-suite/tests/valid/arrays-hetergeneous.toml b/test-suite/tests/valid/arrays-hetergeneous.milf index a246fcf..a246fcf 100644 --- a/test-suite/tests/valid/arrays-hetergeneous.toml +++ b/test-suite/tests/valid/arrays-hetergeneous.milf diff --git a/test-suite/tests/valid/arrays-nested.toml b/test-suite/tests/valid/arrays-nested.milf index ce33022..ce33022 100644 --- a/test-suite/tests/valid/arrays-nested.toml +++ b/test-suite/tests/valid/arrays-nested.milf diff --git a/test-suite/tests/valid/arrays.toml b/test-suite/tests/valid/arrays.milf index c435f57..c435f57 100644 --- a/test-suite/tests/valid/arrays.toml +++ b/test-suite/tests/valid/arrays.milf diff --git a/test-suite/tests/valid/bool.toml b/test-suite/tests/valid/bool.milf index a8a829b..a8a829b 100644 --- a/test-suite/tests/valid/bool.toml +++ b/test-suite/tests/valid/bool.milf diff --git a/test-suite/tests/valid/comments-everywhere.toml b/test-suite/tests/valid/comments-everywhere.milf index 3dca74c..3dca74c 100644 --- a/test-suite/tests/valid/comments-everywhere.toml +++ b/test-suite/tests/valid/comments-everywhere.milf diff --git a/test-suite/tests/valid/datetime-truncate.toml b/test-suite/tests/valid/datetime-truncate.milf index 05de841..05de841 100644 --- a/test-suite/tests/valid/datetime-truncate.toml +++ b/test-suite/tests/valid/datetime-truncate.milf diff --git a/test-suite/tests/valid/datetime.toml b/test-suite/tests/valid/datetime.milf index 2e99340..2e99340 100644 --- a/test-suite/tests/valid/datetime.toml +++ b/test-suite/tests/valid/datetime.milf diff --git a/test-suite/tests/valid/dotted-keys.toml b/test-suite/tests/valid/dotted-keys.milf index 234d64c..234d64c 100644 --- a/test-suite/tests/valid/dotted-keys.toml +++ b/test-suite/tests/valid/dotted-keys.milf diff --git a/test-suite/tests/valid/empty.toml b/test-suite/tests/valid/empty.milf index e69de29..e69de29 100644 --- a/test-suite/tests/valid/empty.toml +++ b/test-suite/tests/valid/empty.milf diff --git a/test-suite/tests/valid/example-bom.toml b/test-suite/tests/valid/example-bom.milf index fb5ac81..fb5ac81 100644 --- a/test-suite/tests/valid/example-bom.toml +++ b/test-suite/tests/valid/example-bom.milf diff --git a/test-suite/tests/valid/example-v0.3.0.toml b/test-suite/tests/valid/example-v0.3.0.milf index 76aacc3..dff4c8a 100644 --- a/test-suite/tests/valid/example-v0.3.0.toml +++ b/test-suite/tests/valid/example-v0.3.0.milf @@ -14,7 +14,7 @@ key = "value" # Yeah, you can do this. [dog.tater] type = "pug" -# You don't need to specify all the super-tables if you don't want to. TOML knows how to do it for you. +# You don't need to specify all the super-tables if you don't want to. MILF knows how to do it for you. # [x] you # [x.y] don't diff --git a/test-suite/tests/valid/example-v0.4.0.toml b/test-suite/tests/valid/example-v0.4.0.milf index 69f1c1b..061e3c8 100644 --- a/test-suite/tests/valid/example-v0.4.0.toml +++ b/test-suite/tests/valid/example-v0.4.0.milf @@ -22,7 +22,7 @@ key = "value" # Yeah, you can do this. key = "another value" -# You don't need to specify all the super-tables if you don't want to. TOML +# You don't need to specify all the super-tables if you don't want to. MILF # knows how to do it for you. # [x] you diff --git a/test-suite/tests/valid/example.toml b/test-suite/tests/valid/example.milf index 8cb02e0..8cb02e0 100644 --- a/test-suite/tests/valid/example.toml +++ b/test-suite/tests/valid/example.milf diff --git a/test-suite/tests/valid/example2.json b/test-suite/tests/valid/example2.json index 3249a97..5471d7f 100644 --- a/test-suite/tests/valid/example2.json +++ b/test-suite/tests/valid/example2.json @@ -1 +1 @@ -{"clients":{"data":{"type":"array","value":[{"type":"array","value":[{"type":"string","value":"gamma"},{"type":"string","value":"delta"}]},{"type":"array","value":[{"type":"integer","value":"1"},{"type":"integer","value":"2"}]}]},"hosts":{"type":"array","value":[{"type":"string","value":"alpha"},{"type":"string","value":"omega"}]}},"database":{"connection_max":{"type":"integer","value":"5000"},"enabled":{"type":"bool","value":"true"},"ports":{"type":"array","value":[{"type":"integer","value":"8001"},{"type":"integer","value":"8001"},{"type":"integer","value":"8002"}]},"server":{"type":"string","value":"192.168.1.1"}},"owner":{"bio":{"type":"string","value":"GitHub Cofounder \u0026 CEO\nLikes tater tots and beer."},"dob":{"type":"datetime","value":"1979-05-27T07:32:00Z"},"name":{"type":"string","value":"Tom Preston-Werner"},"organization":{"type":"string","value":"GitHub"}},"products":[{"name":{"type":"string","value":"Hammer"},"sku":{"type":"integer","value":"738594937"}},{"color":{"type":"string","value":"gray"},"name":{"type":"string","value":"Nail"},"sku":{"type":"integer","value":"284758393"}}],"servers":{"alpha":{"dc":{"type":"string","value":"eqdc10"},"ip":{"type":"string","value":"10.0.0.1"}},"beta":{"country":{"type":"string","value":"中国"},"dc":{"type":"string","value":"eqdc10"},"ip":{"type":"string","value":"10.0.0.2"}}},"title":{"type":"string","value":"TOML Example"}} +{"clients":{"data":{"type":"array","value":[{"type":"array","value":[{"type":"string","value":"gamma"},{"type":"string","value":"delta"}]},{"type":"array","value":[{"type":"integer","value":"1"},{"type":"integer","value":"2"}]}]},"hosts":{"type":"array","value":[{"type":"string","value":"alpha"},{"type":"string","value":"omega"}]}},"database":{"connection_max":{"type":"integer","value":"5000"},"enabled":{"type":"bool","value":"true"},"ports":{"type":"array","value":[{"type":"integer","value":"8001"},{"type":"integer","value":"8001"},{"type":"integer","value":"8002"}]},"server":{"type":"string","value":"192.168.1.1"}},"owner":{"bio":{"type":"string","value":"GitHub Cofounder \u0026 CEO\nLikes tater tots and beer."},"dob":{"type":"datetime","value":"1979-05-27T07:32:00Z"},"name":{"type":"string","value":"Tom Preston-Werner"},"organization":{"type":"string","value":"GitHub"}},"products":[{"name":{"type":"string","value":"Hammer"},"sku":{"type":"integer","value":"738594937"}},{"color":{"type":"string","value":"gray"},"name":{"type":"string","value":"Nail"},"sku":{"type":"integer","value":"284758393"}}],"servers":{"alpha":{"dc":{"type":"string","value":"eqdc10"},"ip":{"type":"string","value":"10.0.0.1"}},"beta":{"country":{"type":"string","value":"中国"},"dc":{"type":"string","value":"eqdc10"},"ip":{"type":"string","value":"10.0.0.2"}}},"title":{"type":"string","value":"MILF Example"}} diff --git a/test-suite/tests/valid/example2.toml b/test-suite/tests/valid/example2.milf index bc12c99..75b138c 100644 --- a/test-suite/tests/valid/example2.toml +++ b/test-suite/tests/valid/example2.milf @@ -1,6 +1,6 @@ -# This is a TOML document. Boom. +# This is a MILF document. Boom. -title = "TOML Example" +title = "MILF Example" [owner] name = "Tom Preston-Werner" @@ -16,7 +16,7 @@ enabled = true [servers] - # You can indent as you please. Tabs or spaces. TOML don't care. + # You can indent as you please. Tabs or spaces. MILF don't care. [servers.alpha] ip = "10.0.0.1" dc = "eqdc10" diff --git a/test-suite/tests/valid/float-exponent.toml b/test-suite/tests/valid/float-exponent.milf index 5349db3..5349db3 100644 --- a/test-suite/tests/valid/float-exponent.toml +++ b/test-suite/tests/valid/float-exponent.milf diff --git a/test-suite/tests/valid/float.toml b/test-suite/tests/valid/float.milf index 7c528d2..7c528d2 100644 --- a/test-suite/tests/valid/float.toml +++ b/test-suite/tests/valid/float.milf diff --git a/test-suite/tests/valid/hard_example.toml b/test-suite/tests/valid/hard_example.milf index 38856c8..d2181ec 100644 --- a/test-suite/tests/valid/hard_example.toml +++ b/test-suite/tests/valid/hard_example.milf @@ -1,5 +1,5 @@ -# Test file for TOML -# Only this one tries to emulate a TOML file written by a user of the kind of parser writers probably hate +# Test file for MILF +# Only this one tries to emulate a MILF file written by a user of the kind of parser writers probably hate # This part you'll really hate [the] diff --git a/test-suite/tests/valid/implicit-and-explicit-after.toml b/test-suite/tests/valid/implicit-and-explicit-after.milf index c0e8865..c0e8865 100644 --- a/test-suite/tests/valid/implicit-and-explicit-after.toml +++ b/test-suite/tests/valid/implicit-and-explicit-after.milf diff --git a/test-suite/tests/valid/implicit-and-explicit-before.toml b/test-suite/tests/valid/implicit-and-explicit-before.milf index eee68ff..eee68ff 100644 --- a/test-suite/tests/valid/implicit-and-explicit-before.toml +++ b/test-suite/tests/valid/implicit-and-explicit-before.milf diff --git a/test-suite/tests/valid/implicit-groups.toml b/test-suite/tests/valid/implicit-groups.milf index b6333e4..b6333e4 100644 --- a/test-suite/tests/valid/implicit-groups.toml +++ b/test-suite/tests/valid/implicit-groups.milf diff --git a/test-suite/tests/valid/integer.toml b/test-suite/tests/valid/integer.milf index 8362459..8362459 100644 --- a/test-suite/tests/valid/integer.toml +++ b/test-suite/tests/valid/integer.milf diff --git a/test-suite/tests/valid/key-equals-nospace.toml b/test-suite/tests/valid/key-equals-nospace.milf index 560901c..560901c 100644 --- a/test-suite/tests/valid/key-equals-nospace.toml +++ b/test-suite/tests/valid/key-equals-nospace.milf diff --git a/test-suite/tests/valid/key-quote-newline.toml b/test-suite/tests/valid/key-quote-newline.milf index a2639bf..a2639bf 100644 --- a/test-suite/tests/valid/key-quote-newline.toml +++ b/test-suite/tests/valid/key-quote-newline.milf diff --git a/test-suite/tests/valid/key-space.toml b/test-suite/tests/valid/key-space.milf index f4f36c4..f4f36c4 100644 --- a/test-suite/tests/valid/key-space.toml +++ b/test-suite/tests/valid/key-space.milf diff --git a/test-suite/tests/valid/key-special-chars.toml b/test-suite/tests/valid/key-special-chars.milf index dc43625..dc43625 100644 --- a/test-suite/tests/valid/key-special-chars.toml +++ b/test-suite/tests/valid/key-special-chars.milf diff --git a/test-suite/tests/valid/key-with-pound.toml b/test-suite/tests/valid/key-with-pound.milf index 65b766f..65b766f 100644 --- a/test-suite/tests/valid/key-with-pound.toml +++ b/test-suite/tests/valid/key-with-pound.milf diff --git a/test-suite/tests/valid/long-float.toml b/test-suite/tests/valid/long-float.milf index 9558ae4..9558ae4 100644 --- a/test-suite/tests/valid/long-float.toml +++ b/test-suite/tests/valid/long-float.milf diff --git a/test-suite/tests/valid/long-integer.toml b/test-suite/tests/valid/long-integer.milf index 424a13a..424a13a 100644 --- a/test-suite/tests/valid/long-integer.toml +++ b/test-suite/tests/valid/long-integer.milf diff --git a/test-suite/tests/valid/multiline-string.toml b/test-suite/tests/valid/multiline-string.milf index 2c4237f..2c4237f 100644 --- a/test-suite/tests/valid/multiline-string.toml +++ b/test-suite/tests/valid/multiline-string.milf diff --git a/test-suite/tests/valid/quote-surrounded-value.toml b/test-suite/tests/valid/quote-surrounded-value.milf index dc8697e..dc8697e 100644 --- a/test-suite/tests/valid/quote-surrounded-value.toml +++ b/test-suite/tests/valid/quote-surrounded-value.milf diff --git a/test-suite/tests/valid/raw-multiline-string.toml b/test-suite/tests/valid/raw-multiline-string.milf index 8094c03..8094c03 100644 --- a/test-suite/tests/valid/raw-multiline-string.toml +++ b/test-suite/tests/valid/raw-multiline-string.milf diff --git a/test-suite/tests/valid/raw-string.toml b/test-suite/tests/valid/raw-string.milf index 92acd25..92acd25 100644 --- a/test-suite/tests/valid/raw-string.toml +++ b/test-suite/tests/valid/raw-string.milf diff --git a/test-suite/tests/valid/string-delim-end.toml b/test-suite/tests/valid/string-delim-end.milf index 9a41219..9a41219 100644 --- a/test-suite/tests/valid/string-delim-end.toml +++ b/test-suite/tests/valid/string-delim-end.milf diff --git a/test-suite/tests/valid/string-empty.toml b/test-suite/tests/valid/string-empty.milf index e37e681..e37e681 100644 --- a/test-suite/tests/valid/string-empty.toml +++ b/test-suite/tests/valid/string-empty.milf diff --git a/test-suite/tests/valid/string-escapes.toml b/test-suite/tests/valid/string-escapes.milf index 152c6ad..152c6ad 100644 --- a/test-suite/tests/valid/string-escapes.toml +++ b/test-suite/tests/valid/string-escapes.milf diff --git a/test-suite/tests/valid/string-simple.toml b/test-suite/tests/valid/string-simple.milf index e17ade6..e17ade6 100644 --- a/test-suite/tests/valid/string-simple.toml +++ b/test-suite/tests/valid/string-simple.milf diff --git a/test-suite/tests/valid/string-with-pound.toml b/test-suite/tests/valid/string-with-pound.milf index 5fd8746..5fd8746 100644 --- a/test-suite/tests/valid/string-with-pound.toml +++ b/test-suite/tests/valid/string-with-pound.milf diff --git a/test-suite/tests/valid/table-array-implicit.toml b/test-suite/tests/valid/table-array-implicit.milf index 3157ac9..3157ac9 100644 --- a/test-suite/tests/valid/table-array-implicit.toml +++ b/test-suite/tests/valid/table-array-implicit.milf diff --git a/test-suite/tests/valid/table-array-many.toml b/test-suite/tests/valid/table-array-many.milf index 46062be..46062be 100644 --- a/test-suite/tests/valid/table-array-many.toml +++ b/test-suite/tests/valid/table-array-many.milf diff --git a/test-suite/tests/valid/table-array-nest-no-keys.toml b/test-suite/tests/valid/table-array-nest-no-keys.milf index ad6eb10..ad6eb10 100644 --- a/test-suite/tests/valid/table-array-nest-no-keys.toml +++ b/test-suite/tests/valid/table-array-nest-no-keys.milf diff --git a/test-suite/tests/valid/table-array-nest.toml b/test-suite/tests/valid/table-array-nest.milf index d659a3d..d659a3d 100644 --- a/test-suite/tests/valid/table-array-nest.toml +++ b/test-suite/tests/valid/table-array-nest.milf diff --git a/test-suite/tests/valid/table-array-one.toml b/test-suite/tests/valid/table-array-one.milf index cd7e1b6..cd7e1b6 100644 --- a/test-suite/tests/valid/table-array-one.toml +++ b/test-suite/tests/valid/table-array-one.milf diff --git a/test-suite/tests/valid/table-empty.toml b/test-suite/tests/valid/table-empty.milf index 8bb6a0a..8bb6a0a 100644 --- a/test-suite/tests/valid/table-empty.toml +++ b/test-suite/tests/valid/table-empty.milf diff --git a/test-suite/tests/valid/table-multi-empty.toml b/test-suite/tests/valid/table-multi-empty.milf index 2266ed2..2266ed2 100644 --- a/test-suite/tests/valid/table-multi-empty.toml +++ b/test-suite/tests/valid/table-multi-empty.milf diff --git a/test-suite/tests/valid/table-sub-empty.toml b/test-suite/tests/valid/table-sub-empty.milf index 70b7fe1..70b7fe1 100644 --- a/test-suite/tests/valid/table-sub-empty.toml +++ b/test-suite/tests/valid/table-sub-empty.milf diff --git a/test-suite/tests/valid/table-whitespace.toml b/test-suite/tests/valid/table-whitespace.milf index daf881d..daf881d 100644 --- a/test-suite/tests/valid/table-whitespace.toml +++ b/test-suite/tests/valid/table-whitespace.milf diff --git a/test-suite/tests/valid/table-with-pound.toml b/test-suite/tests/valid/table-with-pound.milf index 33f2c4f..33f2c4f 100644 --- a/test-suite/tests/valid/table-with-pound.toml +++ b/test-suite/tests/valid/table-with-pound.milf diff --git a/test-suite/tests/valid/unicode-escape.toml b/test-suite/tests/valid/unicode-escape.milf index 6654252..6654252 100644 --- a/test-suite/tests/valid/unicode-escape.toml +++ b/test-suite/tests/valid/unicode-escape.milf diff --git a/test-suite/tests/valid/unicode-literal.toml b/test-suite/tests/valid/unicode-literal.milf index c65723c..c65723c 100644 --- a/test-suite/tests/valid/unicode-literal.toml +++ b/test-suite/tests/valid/unicode-literal.milf diff --git a/tests/enum_external_deserialize.rs b/tests/enum_external_deserialize.rs index 6d45b48..6bed586 100644 --- a/tests/enum_external_deserialize.rs +++ b/tests/enum_external_deserialize.rs @@ -1,6 +1,6 @@ #[macro_use] extern crate serde_derive; -extern crate toml; +extern crate milf; #[derive(Debug, Deserialize, PartialEq)] struct OuterStruct { @@ -27,7 +27,7 @@ struct Multi { #[test] fn invalid_variant_returns_error_with_good_message_string() { - let error = toml::from_str::<TheEnum>("\"NonExistent\"").unwrap_err(); + let error = milf::from_str::<TheEnum>("\"NonExistent\"").unwrap_err(); assert_eq!( error.to_string(), @@ -37,7 +37,7 @@ fn invalid_variant_returns_error_with_good_message_string() { #[test] fn invalid_variant_returns_error_with_good_message_inline_table() { - let error = toml::from_str::<TheEnum>("{ NonExistent = {} }").unwrap_err(); + let error = milf::from_str::<TheEnum>("{ NonExistent = {} }").unwrap_err(); assert_eq!( error.to_string(), "unknown variant `NonExistent`, expected one of `Plain`, `Tuple`, `NewType`, `Struct`" @@ -46,14 +46,14 @@ fn invalid_variant_returns_error_with_good_message_inline_table() { #[test] fn extra_field_returns_expected_empty_table_error() { - let error = toml::from_str::<TheEnum>("{ Plain = { extra_field = 404 } }").unwrap_err(); + let error = milf::from_str::<TheEnum>("{ Plain = { extra_field = 404 } }").unwrap_err(); assert_eq!(error.to_string(), "expected empty table"); } #[test] fn extra_field_returns_expected_empty_table_error_struct_variant() { - let error = toml::from_str::<TheEnum>("{ Struct = { value = 123, extra_0 = 0, extra_1 = 1 } }") + let error = milf::from_str::<TheEnum>("{ Struct = { value = 123, extra_0 = 0, extra_1 = 1 } }") .unwrap_err(); assert_eq!( @@ -67,23 +67,23 @@ mod enum_unit { #[test] fn from_str() { - assert_eq!(TheEnum::Plain, toml::from_str("\"Plain\"").unwrap()); + assert_eq!(TheEnum::Plain, milf::from_str("\"Plain\"").unwrap()); } #[test] fn from_inline_table() { - assert_eq!(TheEnum::Plain, toml::from_str("{ Plain = {} }").unwrap()); + assert_eq!(TheEnum::Plain, milf::from_str("{ Plain = {} }").unwrap()); assert_eq!( Val { val: TheEnum::Plain }, - toml::from_str("val = { Plain = {} }").unwrap() + milf::from_str("val = { Plain = {} }").unwrap() ); } #[test] fn from_dotted_table() { - assert_eq!(TheEnum::Plain, toml::from_str("[Plain]\n").unwrap()); + assert_eq!(TheEnum::Plain, milf::from_str("[Plain]\n").unwrap()); } } @@ -94,13 +94,13 @@ mod enum_tuple { fn from_inline_table() { assert_eq!( TheEnum::Tuple(-123, true), - toml::from_str("{ Tuple = { 0 = -123, 1 = true } }").unwrap() + milf::from_str("{ Tuple = { 0 = -123, 1 = true } }").unwrap() ); assert_eq!( Val { val: TheEnum::Tuple(-123, true) }, - toml::from_str("val = { Tuple = { 0 = -123, 1 = true } }").unwrap() + milf::from_str("val = { Tuple = { 0 = -123, 1 = true } }").unwrap() ); } @@ -108,7 +108,7 @@ mod enum_tuple { fn from_dotted_table() { assert_eq!( TheEnum::Tuple(-123, true), - toml::from_str( + milf::from_str( r#"[Tuple] 0 = -123 1 = true @@ -126,13 +126,13 @@ mod enum_newtype { fn from_inline_table() { assert_eq!( TheEnum::NewType("value".to_string()), - toml::from_str(r#"{ NewType = "value" }"#).unwrap() + milf::from_str(r#"{ NewType = "value" }"#).unwrap() ); assert_eq!( Val { val: TheEnum::NewType("value".to_string()), }, - toml::from_str(r#"val = { NewType = "value" }"#).unwrap() + milf::from_str(r#"val = { NewType = "value" }"#).unwrap() ); } @@ -141,13 +141,13 @@ mod enum_newtype { fn from_dotted_table() { assert_eq!( TheEnum::NewType("value".to_string()), - toml::from_str(r#"NewType = "value""#).unwrap() + milf::from_str(r#"NewType = "value""#).unwrap() ); assert_eq!( Val { val: TheEnum::NewType("value".to_string()), }, - toml::from_str( + milf::from_str( r#"[val] NewType = "value" "# @@ -164,13 +164,13 @@ mod enum_struct { fn from_inline_table() { assert_eq!( TheEnum::Struct { value: -123 }, - toml::from_str("{ Struct = { value = -123 } }").unwrap() + milf::from_str("{ Struct = { value = -123 } }").unwrap() ); assert_eq!( Val { val: TheEnum::Struct { value: -123 } }, - toml::from_str("val = { Struct = { value = -123 } }").unwrap() + milf::from_str("val = { Struct = { value = -123 } }").unwrap() ); } @@ -178,7 +178,7 @@ mod enum_struct { fn from_dotted_table() { assert_eq!( TheEnum::Struct { value: -123 }, - toml::from_str( + milf::from_str( r#"[Struct] value = -123 "# @@ -193,7 +193,7 @@ mod enum_struct { OuterStruct { inner: TheEnum::Struct { value: -123 } }, - toml::from_str( + milf::from_str( r#"[inner.Struct] value = -123 "# @@ -208,7 +208,7 @@ mod enum_array { #[test] fn from_inline_tables() { - let toml_str = r#" + let milf_str = r#" enums = [ { Plain = {} }, { Tuple = { 0 = -123, 1 = true } }, @@ -224,14 +224,14 @@ mod enum_array { TheEnum::Struct { value: -123 }, ] }, - toml::from_str(toml_str).unwrap() + milf::from_str(milf_str).unwrap() ); } #[test] #[ignore = "Unimplemented: https://github.com/alexcrichton/toml-rs/pull/264#issuecomment-431707209"] fn from_dotted_table() { - let toml_str = r#"[[enums]] + let milf_str = r#"[[enums]] Plain = {} [[enums]] @@ -252,7 +252,7 @@ mod enum_array { TheEnum::Struct { value: -123 }, ] }, - toml::from_str(toml_str).unwrap() + milf::from_str(milf_str).unwrap() ); } } |