-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
Bitsets implement Default
#162
Conversation
f5f49cd
to
2772e08
Compare
Thanks! This was already suggested in #101 (comment), but there are a few problems with a
It also seems like it wouldn't solve the problem you have here.
What you're looking for here is an implementation of default parameters rather than enum defaults. There has been some discussion over at gdnative: godot-rust/gdnative#814 |
2772e08
to
5965e0b
Compare
Changed it so that only Bitsets implement |
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 good! For now, I think default()
is a good enabler, although in the future I might consider adding something like an ALL_UNSET
constant or so instead.
Just a small comment, then should be good to go 🙂
bors try
godot-codegen/src/util.rs
Outdated
derives.push("Default"); | ||
} | ||
|
||
let derives: Vec<_> = derives.into_iter().map(ident).collect(); |
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.
collect()
should not be necessary, I think the expression inside quote!
can also work on an iterator.
tryBuild succeeded: |
5965e0b
to
62f0f8b
Compare
Thanks! |
Build succeeded: |
Adds a
Default
implementation for Enums.This came about because I wanted to use
ArrayMesh::add_surface_from_arrays
withSurfaceTool::commit_to_arrays
but had no idea whichArrayFormat
to use. In the docs the default value is0
.