Skip to content

Commit c19cd61

Browse files
committed
Rename ApiParam -> ParamType (natural specialization of GodotType)
1 parent 574b5c7 commit c19cd61

File tree

7 files changed

+26
-26
lines changed

7 files changed

+26
-26
lines changed

godot-core/src/builtin/collections/array.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use crate::builtin::*;
1212
use crate::meta;
1313
use crate::meta::error::{ConvertError, FromGodotError, FromVariantError};
1414
use crate::meta::{
15-
ApiParam, ArrayElement, ArrayTypeInfo, AsArg, CowArg, FromGodot, GodotConvert, GodotFfiVariant,
16-
GodotType, PropertyHintInfo, RefArg, ToGodot,
15+
ArrayElement, ArrayTypeInfo, AsArg, CowArg, FromGodot, GodotConvert, GodotFfiVariant,
16+
GodotType, ParamType, PropertyHintInfo, RefArg, ToGodot,
1717
};
1818
use crate::registry::property::{Export, Var};
1919
use godot_ffi as sys;
@@ -944,7 +944,7 @@ impl<'r, T: ArrayElement> AsArg<Array<T>> for &'r Array<T> {
944944
}
945945
}
946946

947-
impl<T: ArrayElement> ApiParam for Array<T> {
947+
impl<T: ArrayElement> ParamType for Array<T> {
948948
type Arg<'v> = CowArg<'v, Self>;
949949

950950
fn owned_to_arg<'v>(self) -> Self::Arg<'v> {
@@ -1221,7 +1221,7 @@ impl<T: ArrayElement + ToGodot> Extend<T> for Array<T> {
12211221
// A faster implementation using `resize()` and direct pointer writes might still be possible.
12221222
// Note that this could technically also use iter(), since no moves need to happen (however Extend requires IntoIterator).
12231223
for item in iter.into_iter() {
1224-
self.push(ApiParam::owned_to_arg(item));
1224+
self.push(ParamType::owned_to_arg(item));
12251225
}
12261226
}
12271227
}

godot-core/src/builtin/collections/packed_array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ macro_rules! impl_packed_array {
491491
// A faster implementation using `resize()` and direct pointer writes might still be
492492
// possible.
493493
for item in iter.into_iter() {
494-
self.push(meta::ApiParam::owned_to_arg(item));
494+
self.push(meta::ParamType::owned_to_arg(item));
495495
}
496496
}
497497
}

godot-core/src/meta/args/as_arg.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use std::ffi::CStr;
2323
/// Implicitly converting from `T` for by-ref builtins is explicitly not supported. This emphasizes that there is no need to consume the object,
2424
/// thus discourages unnecessary cloning.
2525
///
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()`].
2727
///
2828
/// # Performance for strings
2929
/// 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;
5050
note = "GString/StringName/NodePath aren't implicitly convertible for performance reasons; use their `arg()` method.",
5151
note = "See also `AsArg` docs: https://godot-rust.github.io/docs/gdext/master/godot/meta/trait.AsArg.html"
5252
)]
53-
pub trait AsArg<T: ApiParam>
53+
pub trait AsArg<T: ParamType>
5454
where
5555
Self: Sized,
5656
{
5757
#[doc(hidden)]
58-
fn into_arg<'r>(self) -> <T as ApiParam>::Arg<'r>
58+
fn into_arg<'r>(self) -> <T as ParamType>::Arg<'r>
5959
where
6060
Self: 'r;
6161
}
@@ -77,7 +77,7 @@ macro_rules! arg_into_ref {
7777
};
7878
($arg_variable:ident: $T:ty) => {
7979
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);
8181
};
8282
}
8383

@@ -89,21 +89,21 @@ macro_rules! arg_into_owned {
8989
($arg_variable:ident) => {
9090
let $arg_variable = $arg_variable.into_arg();
9191
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.
9393
};
9494
}
9595

9696
#[macro_export]
9797
macro_rules! impl_asarg_by_value {
9898
($T:ty) => {
9999
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> {
101101
// Moves value (but typically a Copy type).
102102
self
103103
}
104104
}
105105

106-
impl $crate::meta::ApiParam for $T {
106+
impl $crate::meta::ParamType for $T {
107107
type Arg<'v> = $T;
108108

109109
fn owned_to_arg<'v>(self) -> Self::Arg<'v> {
@@ -128,15 +128,15 @@ macro_rules! impl_asarg_by_ref {
128128
// Thus, keep `where` on same line.
129129
// type ArgType<'v> = &'v $T where Self: 'v;
130130

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>
132132
where
133133
'r: 'cow, // Original reference must be valid for at least as long as the returned cow.
134134
{
135135
$crate::meta::CowArg::Borrowed(self)
136136
}
137137
}
138138

139-
impl $crate::meta::ApiParam for $T {
139+
impl $crate::meta::ParamType for $T {
140140
type Arg<'v> = $crate::meta::CowArg<'v, $T>;
141141

142142
fn owned_to_arg<'v>(self) -> Self::Arg<'v> {
@@ -157,11 +157,11 @@ macro_rules! declare_arg_method {
157157
///
158158
/// # Generic bounds
159159
/// 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.
161161
pub fn arg<T>(&self) -> impl $crate::meta::AsArg<T>
162162
where
163163
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>>
165165
+ 'a,
166166
{
167167
$crate::meta::CowArg::Owned(T::from(self))
@@ -178,7 +178,7 @@ macro_rules! declare_arg_method {
178178
/// This is necessary for packed array dispatching to different "inner" backend signatures.
179179
impl<'a, T> AsArg<T> for CowArg<'a, T>
180180
where
181-
for<'r> T: ApiParam<Arg<'r> = CowArg<'r, T>> + 'r,
181+
for<'r> T: ParamType<Arg<'r> = CowArg<'r, T>> + 'r,
182182
{
183183
fn into_arg<'r>(self) -> CowArg<'r, T>
184184
where
@@ -188,7 +188,7 @@ where
188188
}
189189
}
190190

191-
// impl<'a, T> ApiParam for CowArg<'a, T> {
191+
// impl<'a, T> ParamType for CowArg<'a, T> {
192192
// type Type<'v> = CowArg<'v, T>
193193
// where Self: 'v;
194194
// }
@@ -250,7 +250,7 @@ impl AsArg<NodePath> for &String {
250250
// ----------------------------------------------------------------------------------------------------------------------------------------------
251251

252252
/// 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
254254
// GodotType bound not required right now, but conceptually should always be the case.
255255
{
256256
/// Canonical argument passing type, either `T` or an internally-used CoW type.

godot-core/src/meta/args/cow_arg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl<'r, T> CowArg<'r, T> {
4747
}
4848
}
4949

50-
/// Exists for polymorphism in [`crate::meta::ApiParam`].
50+
/// Exists for polymorphism in [`crate::meta::ParamType`].
5151
///
5252
/// Necessary for generics in e.g. `Array<T>`, when accepting `impl AsArg<T>` parameters.
5353
///

godot-core/src/meta/args/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ mod ref_arg;
1313
// ----------------------------------------------------------------------------------------------------------------------------------------------
1414
// Public APIs
1515

16-
pub use as_arg::{ApiParam, AsArg};
16+
pub use as_arg::{AsArg, ParamType};
1717
pub use object_arg::AsObjectArg;
1818
pub use ref_arg::RefArg;
1919

godot-core/src/meta/traits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ pub trait GodotType: GodotConvert<Via = Self> + sealed::Sealed + Sized + 'static
162162
message = "`Array<T>` can only store element types supported in Godot arrays (no nesting).",
163163
label = "has invalid element type"
164164
)]
165-
pub trait ArrayElement: GodotType + ToGodot + FromGodot + sealed::Sealed + meta::ApiParam {
165+
pub trait ArrayElement: GodotType + ToGodot + FromGodot + sealed::Sealed + meta::ParamType {
166166
/// Returns the representation of this type as a type string.
167167
///
168168
/// Used for elements in arrays (the latter despite `ArrayElement` not having a direct relation).

godot-core/src/obj/gd.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use crate::builtin::{Callable, NodePath, StringName, Variant};
1616
use crate::global::PropertyHint;
1717
use crate::meta::error::{ConvertError, FromFfiError};
1818
use crate::meta::{
19-
ApiParam, ArrayElement, AsArg, CallContext, ClassName, CowArg, FromGodot, GodotConvert,
20-
GodotType, PropertyHintInfo, RefArg, ToGodot,
19+
ArrayElement, AsArg, CallContext, ClassName, CowArg, FromGodot, GodotConvert, GodotType,
20+
ParamType, PropertyHintInfo, RefArg, ToGodot,
2121
};
2222
use crate::obj::{
2323
bounds, cap, Bounds, EngineEnum, GdDerefTarget, GdMut, GdRef, GodotClass, Inherits, InstanceId,
@@ -781,7 +781,7 @@ impl<'r, T: GodotClass> AsArg<Gd<T>> for &'r Gd<T> {
781781
}
782782
}
783783

784-
impl<T: GodotClass> ApiParam for Gd<T> {
784+
impl<T: GodotClass> ParamType for Gd<T> {
785785
type Arg<'v> = CowArg<'v, Gd<T>>;
786786

787787
fn owned_to_arg<'v>(self) -> Self::Arg<'v> {
@@ -803,7 +803,7 @@ impl<'r, T: GodotClass> AsArg<Option<Gd<T>>> for Option<&'r Gd<T>> {
803803
}
804804
}
805805

806-
impl<T: GodotClass> ApiParam for Option<Gd<T>> {
806+
impl<T: GodotClass> ParamType for Option<Gd<T>> {
807807
type Arg<'v> = CowArg<'v, Option<Gd<T>>>;
808808

809809
fn owned_to_arg<'v>(self) -> Self::Arg<'v> {

0 commit comments

Comments
 (0)