From 7bbbfd046324363c8db1fb15d39aeb02fe7331b5 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Sun, 21 Mar 2021 14:10:24 -0600 Subject: hilarious and original joke --- examples/decode.rs | 8 ++++---- examples/enum_external.rs | 6 +++--- examples/toml2json.rs | 26 +++++++++++++------------- 3 files changed, 20 insertions(+), 20 deletions(-) (limited to 'examples') 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, @@ -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()), } } -- cgit v1.2.3