@@ -26,8 +26,6 @@ use std::ffi::CStr;
26
26
/// Implicitly converting from `T` for by-ref builtins is explicitly not supported. This emphasizes that there is no need to consume the object,
27
27
/// thus discourages unnecessary cloning.
28
28
///
29
- /// If you need to pass owned values in generic code, you can use [`ParamType::owned_to_arg()`].
30
- ///
31
29
/// # Performance for strings
32
30
/// Godot has three string types: [`GString`], [`StringName`] and [`NodePath`]. Conversions between those three, as well as between `String` and
33
31
/// them, is generally expensive because of allocations, re-encoding, validations, hashing, etc. While this doesn't matter for a few strings
@@ -130,41 +128,27 @@ macro_rules! arg_into_owned {
130
128
#[ macro_export]
131
129
macro_rules! impl_asarg_by_value {
132
130
( $T: ty) => {
131
+ #[ expect( deprecated) ]
133
132
impl $crate:: meta:: ParamType for $T {
134
133
type Arg <' v> = $T;
135
134
136
135
fn owned_to_arg<' v>( self ) -> Self :: Arg <' v> {
137
136
self
138
137
}
139
-
140
- fn arg_to_ref<' r>( arg: & ' r Self :: Arg <' _>) -> & ' r Self {
141
- arg
142
- }
143
-
144
- fn arg_into_owned( arg: Self :: Arg <' _>) -> Self {
145
- arg
146
- }
147
138
}
148
139
} ;
149
140
}
150
141
151
142
#[ macro_export]
152
143
macro_rules! impl_asarg_by_ref {
153
144
( $T: ty) => {
145
+ #[ expect( deprecated) ]
154
146
impl $crate:: meta:: ParamType for $T {
155
147
type Arg <' v> = $crate:: meta:: CowArg <' v, $T>;
156
148
157
149
fn owned_to_arg<' v>( self ) -> Self :: Arg <' v> {
158
150
$crate:: meta:: CowArg :: Owned ( self )
159
151
}
160
-
161
- fn arg_to_ref<' r>( arg: & ' r Self :: Arg <' _>) -> & ' r Self {
162
- arg. cow_as_ref( )
163
- }
164
-
165
- fn arg_into_owned( arg: Self :: Arg <' _>) -> Self {
166
- arg. cow_into_owned( )
167
- }
168
152
}
169
153
} ;
170
154
}
@@ -180,7 +164,7 @@ macro_rules! declare_arg_method {
180
164
pub fn arg<T >( & self ) -> impl $crate:: meta:: AsArg <T >
181
165
where
182
166
for <' a> T : From <& ' a Self >
183
- + $crate:: meta:: ParamType < Arg < ' a> = $crate :: meta :: CowArg < ' a , T >>
167
+ + $crate:: meta:: ToGodot
184
168
+ ' a,
185
169
{
186
170
$crate:: meta:: CowArg :: Owned ( T :: from( self ) )
@@ -271,6 +255,10 @@ impl AsArg<NodePath> for &String {
271
255
/// Implemented for all parameter types `T` that are allowed to receive [impl `AsArg<T>`][AsArg].
272
256
// ParamType used to be a subtrait of GodotType, but this can be too restrictive. For example, DynGd is not a "Godot canonical type"
273
257
// (GodotType), however it's still useful to store it in arrays -- which requires AsArg and subsequently ParamType.
258
+ #[ deprecated(
259
+ since = "0.3.2" ,
260
+ note = "This trait is no longer needed and will be removed in 0.4"
261
+ ) ]
274
262
pub trait ParamType : sealed:: Sealed + Sized + ' static + ToGodot
275
263
// GodotType bound not required right now, but conceptually should always be the case.
276
264
{
@@ -290,16 +278,4 @@ pub trait ParamType: sealed::Sealed + Sized + 'static + ToGodot
290
278
///
291
279
/// You should not rely on the exact return type, as it may change in future versions; treat it like `impl AsArg<Self>`.
292
280
fn owned_to_arg < ' v > ( self ) -> Self :: Arg < ' v > ;
293
-
294
- /// Converts an argument to a shared reference.
295
- ///
296
- /// Useful in generic contexts where you need to extract a reference of an argument, independently of how it is passed.
297
- #[ doc( hidden) ] // for now, users are encouraged to use only call-site of impl AsArg; declaration-site may still develop.
298
- fn arg_to_ref < ' r > ( arg : & ' r Self :: Arg < ' _ > ) -> & ' r Self ;
299
-
300
- /// Clones an argument into an owned value.
301
- ///
302
- /// Useful in generic contexts where you need to extract a value of an argument, independently of how it is passed.
303
- #[ doc( hidden) ] // for now, users are encouraged to use only call-site of impl AsArg; declaration-site may still develop.
304
- fn arg_into_owned ( arg : Self :: Arg < ' _ > ) -> Self ;
305
281
}
0 commit comments