Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: field-attrs.md #[serde(skip)] and #[serde(skip_serializing)] content invert #164

Closed
wants to merge 1 commit into from

Conversation

SoonIter
Copy link

No description provided.

Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

I think this documentation was correct before this PR.

Comment on lines +55 to +56
When deserializing, Serde will use `Default::default()` or the function
given by `default = "..."` to get a default value for this field.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not what skip_serializing does. skip_serializing does not affect the behavior of deserialization.

@SoonIter
Copy link
Author

Thanks for the PR!

I think this documentation was correct before this PR.

- ##### `#[serde(skip)]` {#skip}
Skip this field: do not serialize or deserialize it.
When deserializing, Serde will use `Default::default()` or the function
given by `default = "..."` to get a default value for this field.
- ##### `#[serde(skip_serializing)]` {#skip_serializing}
Skip this field when serializing, but not when deserializing.
- ##### `#[serde(skip_deserializing)]` {#skip_deserializing}
Skip this field when deserializing, but not when serializing.
When deserializing, Serde will use `Default::default()` or the function
given by `default = "..."` to get a default value for this field.

I'm sorry, these sentences are not very neat so I think one of these three sentences is not right.
Now I know that only deserializing is a special case which needs Default::default().

@SoonIter SoonIter closed this Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants