From 3caac4e6f39c92229dc75ae3155ecfc63ffe0d51 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 8 May 2016 10:52:23 -0700 Subject: [PATCH] Clarify serialize_with and deserialize_with documentation --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index bb7bb857..570289a0 100644 --- a/README.md +++ b/README.md @@ -705,18 +705,18 @@ Variant Annotations: Field Annotations: -| Annotation | Function | -| ---------- | -------- | -| `#[serde(rename="name")]` | Serialize and deserialize this field with the given name | -| `#[serde(rename(serialize="name1"))]` | Serialize this field with the given name | -| `#[serde(rename(deserialize="name1"))]` | Deserialize this field with the given name | -| `#[serde(default)]` | If the value is not specified, use the `Default::default()` | -| `#[serde(default="$path")]` | Call the path to a function `fn() -> T` to build the value | -| `#[serde(skip_serializing)]` | Do not serialize this value | -| `#[serde(skip_deserializing)]` | Always use `Default::default()` or `#[serde(default="$path")]` instead of deserializing this value | -| `#[serde(skip_serializing_if="$path")]` | Do not serialize this value if this function `fn(&T) -> bool` returns `true` | -| `#[serde(serialize_with="$path")]` | Call a function `fn(&T, &mut S) -> Result<(), S::Error> where S: Serializer` to serialize this value | -| `#[serde(deserialize_with="$path")]` | Call a function `fn(&mut D) -> Result where D: Deserializer` to deserialize this value | +| Annotation | Function | +| ---------- | -------- | +| `#[serde(rename="name")]` | Serialize and deserialize this field with the given name | +| `#[serde(rename(serialize="name1"))]` | Serialize this field with the given name | +| `#[serde(rename(deserialize="name1"))]` | Deserialize this field with the given name | +| `#[serde(default)]` | If the value is not specified, use the `Default::default()` | +| `#[serde(default="$path")]` | Call the path to a function `fn() -> T` to build the value | +| `#[serde(skip_serializing)]` | Do not serialize this value | +| `#[serde(skip_deserializing)]` | Always use `Default::default()` or `#[serde(default="$path")]` instead of deserializing this value | +| `#[serde(skip_serializing_if="$path")]` | Do not serialize this value if this function `fn(&T) -> bool` returns `true` | +| `#[serde(serialize_with="$path")]` | Call a function `fn(&T, &mut S) -> Result<(), S::Error> where S: Serializer` to serialize this value of type `T` | +| `#[serde(deserialize_with="$path")]` | Call a function `fn(&mut D) -> Result where D: Deserializer` to deserialize this value of type `T` | Upgrading from Serde 0.6 ========================