@@ -23,7 +23,7 @@ use std::ffi::CStr;
23
23
/// Implicitly converting from `T` for by-ref builtins is explicitly not supported. This emphasizes that there is no need to consume the object,
24
24
/// thus discourages unnecessary cloning.
25
25
///
26
- /// If you need to pass owned values in generic code, you can use [`ApiParam::value_to_arg ()`].
26
+ /// If you need to pass owned values in generic code, you can use [`ApiParam::owned_to_arg ()`].
27
27
///
28
28
/// # Performance for strings
29
29
/// Godot has three string types: [`GString`], [`StringName`] and [`NodePath`]. Conversions between those three, as well as between `String` and
@@ -106,7 +106,7 @@ macro_rules! impl_asarg_by_value {
106
106
impl $crate:: meta:: ApiParam for $T {
107
107
type Arg <' v> = $T;
108
108
109
- fn value_to_arg <' v>( self ) -> Self :: Arg <' v> {
109
+ fn owned_to_arg <' v>( self ) -> Self :: Arg <' v> {
110
110
self
111
111
}
112
112
@@ -139,7 +139,7 @@ macro_rules! impl_asarg_by_ref {
139
139
impl $crate:: meta:: ApiParam for $T {
140
140
type Arg <' v> = $crate:: meta:: CowArg <' v, $T>;
141
141
142
- fn value_to_arg <' v>( self ) -> Self :: Arg <' v> {
142
+ fn owned_to_arg <' v>( self ) -> Self :: Arg <' v> {
143
143
$crate:: meta:: CowArg :: Owned ( self )
144
144
}
145
145
@@ -252,22 +252,23 @@ impl AsArg<NodePath> for &String {
252
252
/// Implemented for all parameter types `T` that are allowed to receive [impl `AsArg<T>`][AsArg].
253
253
pub trait ApiParam : GodotType
254
254
// GodotType bound not required right now, but conceptually should always be the case.
255
- where
256
- Self : Sized ,
257
255
{
258
256
/// Canonical argument passing type, either `T` or an internally-used CoW type.
259
257
///
260
258
/// The general rule is that `Copy` types are passed by value, while the rest is passed by reference.
261
259
///
262
- /// This associated type is closely related to [`ToGodot::ToVia<'v>`][crate::meta::ToGodot::ToVia] and may be reorganized.
260
+ /// This associated type is closely related to [`ToGodot::ToVia<'v>`][crate::meta::ToGodot::ToVia] and may be reorganized in the future.
261
+ #[ doc( hidden) ]
263
262
type Arg < ' v > : AsArg < Self >
264
263
where
265
264
Self : ' v ;
266
265
267
266
/// Converts an owned value to the canonical argument type, which can be passed to [`impl AsArg<T>`][AsArg].
268
267
///
269
268
/// Useful in generic contexts where only a value is available, and one doesn't want to dispatch between value/reference.
270
- fn value_to_arg < ' v > ( self ) -> Self :: Arg < ' v > ;
269
+ ///
270
+ /// You should not rely on the exact return type, as it may change in future versions; treat it like `impl AsArg<Self>`.
271
+ fn owned_to_arg < ' v > ( self ) -> Self :: Arg < ' v > ;
271
272
272
273
/// Converts an argument to a shared reference.
273
274
///
0 commit comments