-
Notifications
You must be signed in to change notification settings - Fork 235
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
Add support for field defaults to proc-macro frontend #1560
Add support for field defaults to proc-macro frontend #1560
Conversation
3b86514
to
188d264
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me. Unless @mhammond has concerns I think it's ready to merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
}, | ||
FieldMetadata { | ||
name: "age".into(), | ||
ty: Type::U16, | ||
default: None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missed opportunity here for default: Default::default()
:)
@@ -104,6 +104,12 @@ will fail). | |||
pub struct MyRecord { | |||
pub field_a: String, | |||
pub field_b: Option<Arc<MyObject>>, | |||
// Fields can have a default value. | |||
// Currently, only string, integer, float and boolean literals are supported as defaults. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it is worth adding something like "these work the same way as documented for UDL files" or similar (the docs need a restructure, but udl/structs.md does describe this in some detail)
188d264
to
a9dfd35
Compare
Based on #1559.