diff options
Diffstat (limited to 'src/ser.rs')
-rw-r--r-- | src/ser.rs | 38 |
1 files changed, 19 insertions, 19 deletions
@@ -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; |