Skip to content

Commit

Permalink
[itest] add a test that checks if one Class can implement two traits …
Browse files Browse the repository at this point in the history
…via #[godot_dyn]
  • Loading branch information
0x53A committed Dec 5, 2024
1 parent d32d569 commit 8387e78
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions itest/rust/src/object_tests/dyn_gd_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,3 +418,30 @@ impl Health for foreign::NodeHealth {
self.base_mut().set_meta("hp", &new_hp.to_variant());
}
}

// ----------------------------------------------------------------------------------------------------------------------------------------------
// Check that one class can implement two or more traits

pub trait MyTrait1 {
fn do_something(&self);
}

pub trait MyTrait2 {
fn do_something_else(&self);
}

#[derive(GodotClass)]
#[class(init, base=Node)]
pub struct NodeForTwoTraits {
base: Base<Node>,
}

#[godot_dyn]
impl MyTrait1 for NodeForTwoTraits {
fn do_something(&self) {}
}

#[godot_dyn]
impl MyTrait2 for NodeForTwoTraits {
fn do_something_else(&self) {}
}

0 comments on commit 8387e78

Please sign in to comment.