@@ -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 ::owned_to_arg()`].
26
+ /// If you need to pass owned values in generic code, you can use [`ParamType ::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
@@ -50,12 +50,12 @@ use std::ffi::CStr;
50
50
note = "GString/StringName/NodePath aren't implicitly convertible for performance reasons; use their `arg()` method." ,
51
51
note = "See also `AsArg` docs: https://godot-rust.github.io/docs/gdext/master/godot/meta/trait.AsArg.html"
52
52
) ]
53
- pub trait AsArg < T : ApiParam >
53
+ pub trait AsArg < T : ParamType >
54
54
where
55
55
Self : Sized ,
56
56
{
57
57
#[ doc( hidden) ]
58
- fn into_arg < ' r > ( self ) -> <T as ApiParam >:: Arg < ' r >
58
+ fn into_arg < ' r > ( self ) -> <T as ParamType >:: Arg < ' r >
59
59
where
60
60
Self : ' r ;
61
61
}
@@ -77,7 +77,7 @@ macro_rules! arg_into_ref {
77
77
} ;
78
78
( $arg_variable: ident: $T: ty) => {
79
79
let $arg_variable = $arg_variable. into_arg( ) ;
80
- let $arg_variable: & $T = $crate:: meta:: ApiParam :: arg_to_ref( & $arg_variable) ;
80
+ let $arg_variable: & $T = $crate:: meta:: ParamType :: arg_to_ref( & $arg_variable) ;
81
81
} ;
82
82
}
83
83
@@ -89,21 +89,21 @@ macro_rules! arg_into_owned {
89
89
( $arg_variable: ident) => {
90
90
let $arg_variable = $arg_variable. into_arg( ) ;
91
91
let $arg_variable = $arg_variable. cow_into_owned( ) ;
92
- // cow_into_owned() is not yet used generically; could be abstracted in ApiParam ::arg_to_owned() as well.
92
+ // cow_into_owned() is not yet used generically; could be abstracted in ParamType ::arg_to_owned() as well.
93
93
} ;
94
94
}
95
95
96
96
#[ macro_export]
97
97
macro_rules! impl_asarg_by_value {
98
98
( $T: ty) => {
99
99
impl $crate:: meta:: AsArg <$T> for $T {
100
- fn into_arg<' r>( self ) -> <$T as $crate:: meta:: ApiParam >:: Arg <' r> {
100
+ fn into_arg<' r>( self ) -> <$T as $crate:: meta:: ParamType >:: Arg <' r> {
101
101
// Moves value (but typically a Copy type).
102
102
self
103
103
}
104
104
}
105
105
106
- impl $crate:: meta:: ApiParam for $T {
106
+ impl $crate:: meta:: ParamType for $T {
107
107
type Arg <' v> = $T;
108
108
109
109
fn owned_to_arg<' v>( self ) -> Self :: Arg <' v> {
@@ -128,15 +128,15 @@ macro_rules! impl_asarg_by_ref {
128
128
// Thus, keep `where` on same line.
129
129
// type ArgType<'v> = &'v $T where Self: 'v;
130
130
131
- fn into_arg<' cow>( self ) -> <$T as $crate:: meta:: ApiParam >:: Arg <' cow>
131
+ fn into_arg<' cow>( self ) -> <$T as $crate:: meta:: ParamType >:: Arg <' cow>
132
132
where
133
133
' r: ' cow, // Original reference must be valid for at least as long as the returned cow.
134
134
{
135
135
$crate:: meta:: CowArg :: Borrowed ( self )
136
136
}
137
137
}
138
138
139
- impl $crate:: meta:: ApiParam for $T {
139
+ impl $crate:: meta:: ParamType for $T {
140
140
type Arg <' v> = $crate:: meta:: CowArg <' v, $T>;
141
141
142
142
fn owned_to_arg<' v>( self ) -> Self :: Arg <' v> {
@@ -157,11 +157,11 @@ macro_rules! declare_arg_method {
157
157
///
158
158
/// # Generic bounds
159
159
/// The bounds are implementation-defined and may change at any time. Do not use this function in a generic context requiring `T`
160
- /// -- use the `From` trait or [`ApiParam `][crate::meta::ApiParam ] in that case.
160
+ /// -- use the `From` trait or [`ParamType `][crate::meta::ParamType ] in that case.
161
161
pub fn arg<T >( & self ) -> impl $crate:: meta:: AsArg <T >
162
162
where
163
163
for <' a> T : From <& ' a Self >
164
- + $crate:: meta:: ApiParam <Arg <' a> = $crate:: meta:: CowArg <' a, T >>
164
+ + $crate:: meta:: ParamType <Arg <' a> = $crate:: meta:: CowArg <' a, T >>
165
165
+ ' a,
166
166
{
167
167
$crate:: meta:: CowArg :: Owned ( T :: from( self ) )
@@ -178,7 +178,7 @@ macro_rules! declare_arg_method {
178
178
/// This is necessary for packed array dispatching to different "inner" backend signatures.
179
179
impl < ' a , T > AsArg < T > for CowArg < ' a , T >
180
180
where
181
- for < ' r > T : ApiParam < Arg < ' r > = CowArg < ' r , T > > + ' r ,
181
+ for < ' r > T : ParamType < Arg < ' r > = CowArg < ' r , T > > + ' r ,
182
182
{
183
183
fn into_arg < ' r > ( self ) -> CowArg < ' r , T >
184
184
where
@@ -188,7 +188,7 @@ where
188
188
}
189
189
}
190
190
191
- // impl<'a, T> ApiParam for CowArg<'a, T> {
191
+ // impl<'a, T> ParamType for CowArg<'a, T> {
192
192
// type Type<'v> = CowArg<'v, T>
193
193
// where Self: 'v;
194
194
// }
@@ -250,7 +250,7 @@ impl AsArg<NodePath> for &String {
250
250
// ----------------------------------------------------------------------------------------------------------------------------------------------
251
251
252
252
/// Implemented for all parameter types `T` that are allowed to receive [impl `AsArg<T>`][AsArg].
253
- pub trait ApiParam : GodotType
253
+ pub trait ParamType : GodotType
254
254
// GodotType bound not required right now, but conceptually should always be the case.
255
255
{
256
256
/// Canonical argument passing type, either `T` or an internally-used CoW type.
0 commit comments