@@ -16,15 +16,15 @@ use std::ffi::CStr;
16
16
/// this trait is implemented more conservatively.
17
17
///
18
18
/// As a result, `AsArg<T>` is currently only implemented for certain argument types:
19
- /// - `T` for by-value builtins (typically `Copy`): `i32`, `bool`, `Vector3`, `Transform2D`, ...
20
- /// - `&T` for by-ref builtins : `GString`, `Array`, `Dictionary`, `Packed*Array`, `Variant`...
19
+ /// - `T` for by-value built-ins (typically `Copy`): `i32`, `bool`, `Vector3`, `Transform2D`, ...
20
+ /// - `&T` for by-ref built-ins : `GString`, `Array`, `Dictionary`, `Packed*Array`, `Variant`...
21
21
/// - `&str`, `&String` additionally for string types `GString`, `StringName`, `NodePath`.
22
22
///
23
23
/// See also the [`AsObjectArg`][crate::meta::AsObjectArg] trait which is specialized for object arguments. It may be merged with `AsArg`
24
24
/// in the future.
25
25
///
26
26
/// # Pass by value
27
- /// Implicitly converting from `T` for by-ref builtins is explicitly not supported. This emphasizes that there is no need to consume the object,
27
+ /// Implicitly converting from `T` for by-ref built-ins is explicitly not supported. This emphasizes that there is no need to consume the object,
28
28
/// thus discourages unnecessary cloning.
29
29
///
30
30
/// # Performance for strings
@@ -44,8 +44,7 @@ use std::ffi::CStr;
44
44
/// `AsArg` is meant to be used from the function call site, not the declaration site. If you declare a parameter as `impl AsArg<...>` yourself,
45
45
/// you can only forward it as-is to a Godot API -- there are no stable APIs to access the inner object yet.
46
46
///
47
- /// Furthermore, there is currently no benefit in implementing `AsArg` for your own types, as it's only used by Godot APIs which don't accept
48
- /// custom types. Classes are already supported through upcasting and [`AsObjectArg`][crate::meta::AsObjectArg].
47
+ /// If you want to pass your own types to a Godot API i.e. to emit a signal, you should implement the [`ParamType`] trait.
49
48
#[ diagnostic:: on_unimplemented(
50
49
message = "Argument of type `{Self}` cannot be passed to an `impl AsArg<{T}>` parameter" ,
51
50
note = "if you pass by value, consider borrowing instead." ,
@@ -259,6 +258,10 @@ impl AsArg<NodePath> for &String {
259
258
// ----------------------------------------------------------------------------------------------------------------------------------------------
260
259
261
260
/// Implemented for all parameter types `T` that are allowed to receive [impl `AsArg<T>`][AsArg].
261
+ ///
262
+ /// **Deprecated**: This trait is considered deprecated and will be removed in 0.4. It is still required to be implemented by types that should
263
+ /// be passed `AsArg` in the current version, though.
264
+ //
262
265
// ParamType used to be a subtrait of GodotType, but this can be too restrictive. For example, DynGd is not a "Godot canonical type"
263
266
// (GodotType), however it's still useful to store it in arrays -- which requires AsArg and subsequently ParamType.
264
267
//
0 commit comments