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

Simplify implementation of #[serde(default=...)] #367

Merged
merged 1 commit into from
Jun 10, 2016
Merged

Simplify implementation of #[serde(default=...)] #367

merged 1 commit into from
Jun 10, 2016

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Jun 10, 2016

No description provided.

@oli-obk
Copy link
Member

oli-obk commented Jun 10, 2016

lgtm

@homu r+

@homu homu merged commit 3119cc8 into serde-rs:master Jun 10, 2016
homu added a commit that referenced this pull request Jun 10, 2016
Simplify implementation of #[serde(default=...)]
/// The default is given by `std::default::Default::default()`.
Default,
/// The default is given by this function.
Path(ast::Path),

Choose a reason for hiding this comment

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

It would be also great to support literals and constants as well as functions, so you can actually write

#[serde(default="0.1")]
pub field: f32,

Copy link
Member

Choose a reason for hiding this comment

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

The only situation that would be problematic is when the field is of function type, but I don't think we can do anything useful there anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

I filed #368 to track your idea.

Choose a reason for hiding this comment

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

Thanks!

@dtolnay dtolnay deleted the default branch June 10, 2016 16:00
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.

4 participants