From 0f072fad735f03476c884b5257e894a54facc01b Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 30 Oct 2023 11:26:17 -0400 Subject: [PATCH] Improve Value From and FromIterator docs --- src/value/from.rs | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/value/from.rs b/src/value/from.rs index fa3fb3acc..ed1e3338b 100644 --- a/src/value/from.rs +++ b/src/value/from.rs @@ -28,7 +28,8 @@ from_integer! { } impl From for Value { - /// Convert 32-bit floating point number to `Value` + /// Convert 32-bit floating point number to `Value::Number`, or + /// `Value::Null` if infinite or NaN. /// /// # Examples /// @@ -44,7 +45,8 @@ impl From for Value { } impl From for Value { - /// Convert 64-bit floating point number to `Value` + /// Convert 64-bit floating point number to `Value::Number`, or + /// `Value::Null` if infinite or NaN. /// /// # Examples /// @@ -60,7 +62,7 @@ impl From for Value { } impl From for Value { - /// Convert boolean to `Value` + /// Convert boolean to `Value::Bool`. /// /// # Examples /// @@ -76,7 +78,7 @@ impl From for Value { } impl From for Value { - /// Convert `String` to `Value` + /// Convert `String` to `Value::String`. /// /// # Examples /// @@ -92,7 +94,7 @@ impl From for Value { } impl From<&str> for Value { - /// Convert string slice to `Value` + /// Convert string slice to `Value::String`. /// /// # Examples /// @@ -108,7 +110,7 @@ impl From<&str> for Value { } impl<'a> From> for Value { - /// Convert copy-on-write string to `Value` + /// Convert copy-on-write string to `Value::String`. /// /// # Examples /// @@ -133,7 +135,7 @@ impl<'a> From> for Value { } impl From for Value { - /// Convert `Number` to `Value` + /// Convert `Number` to `Value::Number`. /// /// # Examples /// @@ -149,7 +151,7 @@ impl From for Value { } impl From> for Value { - /// Convert map (with string keys) to `Value` + /// Convert map (with string keys) to `Value::Object`. /// /// # Examples /// @@ -166,7 +168,7 @@ impl From> for Value { } impl> From> for Value { - /// Convert a `Vec` to `Value` + /// Convert a `Vec` to `Value::Array`. /// /// # Examples /// @@ -182,7 +184,7 @@ impl> From> for Value { } impl> From<&[T]> for Value { - /// Convert a slice to `Value` + /// Convert a slice to `Value::Array`. /// /// # Examples /// @@ -198,7 +200,7 @@ impl> From<&[T]> for Value { } impl> FromIterator for Value { - /// Convert an iterable type to a `Value` + /// Create a `Value::Array` by collecting an iterator of array elements. /// /// # Examples /// @@ -228,7 +230,7 @@ impl> FromIterator for Value { } impl, V: Into> FromIterator<(K, V)> for Value { - /// Convert an iterable type to a `Value` + /// Create a `Value::Object` by collecting an iterator of key-value pairs. /// /// # Examples /// @@ -248,7 +250,7 @@ impl, V: Into> FromIterator<(K, V)> for Value { } impl From<()> for Value { - /// Convert `()` to `Value` + /// Convert `()` to `Value::Null`. /// /// # Examples ///