Skip to content

Commit

Permalink
Enums implement Default
Browse files Browse the repository at this point in the history
  • Loading branch information
mio991 committed Mar 9, 2023
1 parent ac5f78c commit 2772e08
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion godot-codegen/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub fn make_enum_definition(enum_: &Enum) -> TokenStream {
// TODO maybe generalize GodotFfi over EngineEnum trait
quote! {
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Debug, Hash)]
#[derive(Copy, Clone, Eq, PartialEq, Debug, Hash, Default)]
pub struct #enum_name {
ord: i32
}
Expand Down
2 changes: 1 addition & 1 deletion godot-core/src/obj/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub trait EngineClass: GodotClass {
}

/// Auto-implemented for all engine-provided enums
pub trait EngineEnum: Copy {
pub trait EngineEnum: Copy + Default {
fn try_from_ord(ord: i32) -> Option<Self>;

/// Ordinal value of the enumerator, as specified in Godot.
Expand Down

0 comments on commit 2772e08

Please sign in to comment.