@@ -9,7 +9,7 @@ use crate::builtin::{GString, NodePath, StringName, Variant};
99use crate :: meta:: sealed:: Sealed ;
1010use crate :: meta:: traits:: { GodotFfiVariant , GodotNullableFfi } ;
1111use crate :: meta:: { CowArg , FfiArg , GodotType , ObjectArg , ToGodot } ;
12- use crate :: obj:: { bounds , Bounds , DynGd , Gd , GodotClass , Inherits } ;
12+ use crate :: obj:: { DynGd , Gd , GodotClass , Inherits } ;
1313
1414/// Implicit conversions for arguments passed to Godot APIs.
1515///
@@ -263,7 +263,7 @@ where
263263impl < T , Base > AsArg < Option < Gd < Base > > > for & Gd < T >
264264where
265265 T : Inherits < Base > ,
266- Base : GodotClass + Bounds < Declarer = bounds :: DeclEngine > ,
266+ Base : GodotClass ,
267267{
268268 fn into_arg < ' arg > ( self ) -> CowArg < ' arg , Option < Gd < Base > > >
269269 where
@@ -286,7 +286,7 @@ where
286286impl < T , Base > AsArg < Option < Gd < Base > > > for Option < & Gd < T > >
287287where
288288 T : Inherits < Base > ,
289- Base : GodotClass + Bounds < Declarer = bounds :: DeclEngine > ,
289+ Base : GodotClass ,
290290{
291291 fn into_arg < ' arg > ( self ) -> CowArg < ' arg , Option < Gd < Base > > >
292292 where
@@ -313,7 +313,7 @@ impl<T, D, Base> AsArg<Option<DynGd<Base, D>>> for &DynGd<T, D>
313313where
314314 T : Inherits < Base > ,
315315 D : ?Sized ,
316- Base : GodotClass + Bounds < Declarer = bounds :: DeclEngine > ,
316+ Base : GodotClass ,
317317{
318318 fn into_arg < ' arg > ( self ) -> CowArg < ' arg , Option < DynGd < Base , D > > >
319319 where
@@ -337,7 +337,7 @@ impl<T, D, Base> AsArg<Option<Gd<Base>>> for &DynGd<T, D>
337337where
338338 T : Inherits < Base > ,
339339 D : ?Sized ,
340- Base : GodotClass + Bounds < Declarer = bounds :: DeclEngine > ,
340+ Base : GodotClass ,
341341{
342342 fn into_arg < ' arg > ( self ) -> CowArg < ' arg , Option < Gd < Base > > >
343343 where
@@ -361,7 +361,7 @@ impl<T, D, Base> AsArg<Option<DynGd<Base, D>>> for Option<&DynGd<T, D>>
361361where
362362 T : Inherits < Base > ,
363363 D : ?Sized ,
364- Base : GodotClass + Bounds < Declarer = bounds :: DeclEngine > ,
364+ Base : GodotClass ,
365365{
366366 fn into_arg < ' arg > ( self ) -> CowArg < ' arg , Option < DynGd < Base , D > > >
367367 where
@@ -764,3 +764,35 @@ where
764764
765765#[ doc( hidden) ] // Easier for internal use.
766766pub type ToArg < ' r , Via , Pass > = <Pass as ArgPassing >:: Output < ' r , Via > ;
767+
768+ /// This type exists only as a place to add doctests for `AsArg`, which do not need to be in the public documentation.
769+ ///
770+ /// `AsArg<Option<Gd<UserClass>>` can be used with signals correctly:
771+ ///
772+ /// ```no_run
773+ /// # use godot::prelude::*;
774+ /// #[derive(GodotClass)]
775+ /// #[class(init, base = Node)]
776+ /// struct MyClass {
777+ /// base: Base<Node>
778+ /// }
779+ ///
780+ /// #[godot_api]
781+ /// impl MyClass {
782+ /// #[signal]
783+ /// fn signal_optional_user_obj(arg1: Option<Gd<MyClass>>);
784+ ///
785+ /// fn foo(&mut self) {
786+ /// let arg = self.to_gd();
787+ /// // Directly:
788+ /// self.signals().signal_optional_user_obj().emit(&arg);
789+ /// // Via Some:
790+ /// self.signals().signal_optional_user_obj().emit(Some(&arg));
791+ /// // With None (Note: Gd::null_arg() is restricted to engine classes):
792+ /// self.signals().signal_optional_user_obj().emit(None::<Gd<MyClass>>.as_ref());
793+ /// }
794+ /// }
795+ /// ```
796+ ///
797+ #[ allow( dead_code) ]
798+ struct PhantomAsArgDoctests ;
0 commit comments