Skip to content

Commit 1415e1c

Browse files
committed
Hide RefArg from public API
1 parent 1da68dd commit 1415e1c

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

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

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,19 @@ mod ref_arg;
1313
// ----------------------------------------------------------------------------------------------------------------------------------------------
1414
// Public APIs
1515

16-
pub use as_arg::{
17-
owned_into_arg, ref_to_arg, ArgPassing, AsArg, ByObject, ByOption, ByRef, ByValue, ToArg,
18-
};
19-
2016
// ----------------------------------------------------------------------------------------------------------------------------------------------
2117
// Internal APIs
2218

2319
// Solely public for itest/convert_test.rs.
20+
pub(crate) use as_arg::NullArg;
21+
pub use as_arg::{
22+
owned_into_arg, ref_to_arg, ArgPassing, AsArg, ByObject, ByOption, ByRef, ByValue, ToArg,
23+
};
24+
#[cfg(not(feature = "trace"))]
25+
pub(crate) use cow_arg::{CowArg, FfiArg};
26+
// Integration test only.
2427
#[cfg(feature = "trace")]
2528
#[doc(hidden)]
2629
pub use cow_arg::{CowArg, FfiArg};
27-
#[cfg(not(feature = "trace"))]
28-
pub(crate) use cow_arg::{CowArg, FfiArg};
29-
#[allow(unused)] // TODO(v0.4): replace contents with newer changes
3030
pub use object_arg::ObjectArg;
31-
pub use ref_arg::RefArg;
32-
33-
pub(crate) use as_arg::NullArg;
34-
35-
// #[doc(hidden)]
36-
// pub use cow_arg::*;
37-
//
38-
// #[doc(hidden)]
39-
// pub use ref_arg::*;
31+
pub(crate) use ref_arg::RefArg;

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ use crate::sys;
1616

1717
/// Simple reference wrapper, used when passing arguments by-ref to Godot APIs.
1818
///
19-
/// This type is often used as the result of [`ToGodot::to_godot()`], if `Self` is not a `Copy` type.
19+
/// This type is exclusively used at the FFI boundary, to avoid unnecessary cloning of values.
20+
///
21+
/// Private type. Cannot be `pub(crate)` because it's used in `#[doc(hidden)]` associate type `GodotType::ToFfi<'f>`, and `GodotType` is public.
22+
#[doc(hidden)]
2023
pub struct RefArg<'r, T> {
2124
/// Only `None` if `T: GodotNullableFfi` and `T::is_null()` is true.
2225
shared_ref: Option<&'r T>,

godot-core/src/obj/gd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use sys::{static_assert_eq_size_align, SysPtr as _};
1414
use crate::builtin::{Callable, GString, NodePath, StringName, Variant};
1515
use crate::meta::error::{ConvertError, FromFfiError};
1616
use crate::meta::{
17-
ArrayElement, AsArg, CallContext, ClassName, CowArg, FromGodot, GodotConvert, GodotType,
17+
ArrayElement, AsArg, CallContext, ClassName, FromGodot, GodotConvert, GodotType,
1818
PropertyHintInfo, RefArg, ToGodot,
1919
};
2020
use crate::obj::{

0 commit comments

Comments
 (0)