Skip to content

Commit a23f00f

Browse files
committed
Add Doctest for Wrong Trait Impl
1 parent e7bb4ad commit a23f00f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

godot-macros/src/lib.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,21 @@ pub fn derive_godot_class(input: TokenStream) -> TokenStream {
542542
/// }
543543
/// ```
544544
///
545+
/// Using _any_ trait other than the one corresponding with the base class will result in compilation failure.
546+
///
547+
/// ```compile_fail
548+
/// # use godot::prelude::*;
549+
/// #[derive(GodotClass)]
550+
/// #[class(init, base=Node3D)]
551+
/// pub struct My3DNode;
552+
///
553+
/// #[godot_api]
554+
/// impl INode for My3DNode {
555+
/// fn ready(&mut self) {
556+
/// godot_print!("Hello World!");
557+
/// }
558+
/// }
559+
/// ```
545560
///
546561
/// # User-defined functions
547562
///

0 commit comments

Comments
 (0)