Skip to content

Commit 81a1bc8

Browse files
committed
Adjust imports in derive macros, examples and UI tests
1 parent 5a947cf commit 81a1bc8

File tree

7 files changed

+14
-11
lines changed

7 files changed

+14
-11
lines changed

examples/dodge_the_creeps/src/main_scene.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl Main {
140140
/// scene as the root. For instance Spatial is used for this example.
141141
fn instance_scene<Root>(scene: &Ref<PackedScene, Shared>) -> Ref<Root, Unique>
142142
where
143-
Root: gdnative::GodotObject<RefKind = ManuallyManaged> + SubClass<Node>,
143+
Root: gdnative::object::GodotObject<RefKind = ManuallyManaged> + SubClass<Node>,
144144
{
145145
let scene = unsafe { scene.assume_safe() };
146146

examples/scene_create/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub fn load_scene(path: &str) -> Option<Ref<PackedScene, ThreadLocal>> {
116116
/// scene as the root. For instance Spatial is used for this example.
117117
fn instance_scene<Root>(scene: &PackedScene) -> Result<Ref<Root, Unique>, ManageErrs>
118118
where
119-
Root: gdnative::GodotObject<RefKind = ManuallyManaged> + SubClass<Node>,
119+
Root: gdnative::object::GodotObject<RefKind = ManuallyManaged> + SubClass<Node>,
120120
{
121121
let instance = scene
122122
.instance(PackedScene::GEN_EDIT_STATE_DISABLED)

gdnative-core/src/core_types/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub use rid::*;
4444
pub use string::*;
4545
pub use string_array::*;
4646
pub use transform2d::*;
47-
pub use typed_array::{Element, TypedArray};
47+
pub use typed_array::*; // TODO rename Element to something more specific
4848
pub use variant::*;
4949
pub use variant_array::*;
5050
pub use vector2::*;

gdnative-core/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#[doc(hidden)]
2727
pub extern crate gdnative_sys as sys;
28+
2829
#[doc(hidden)]
2930
pub extern crate libc;
3031

@@ -41,6 +42,7 @@ mod init;
4142
#[cfg(feature = "nativescript")]
4243
pub mod nativescript;
4344

45+
#[doc(hidden)]
4446
pub mod log;
4547
pub mod object;
4648
pub mod ref_kind;

gdnative-derive/src/native_script.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub(crate) fn impl_empty_nativeclass(derive_input: &DeriveInput) -> TokenStream2
2929
fn class_name() -> &'static str {
3030
unimplemented!()
3131
}
32-
fn init(owner: ::gdnative::TRef<'_, Self::Base, Shared>) -> Self {
32+
fn init(owner: ::gdnative::object::TRef<'_, Self::Base, Shared>) -> Self {
3333
unimplemented!()
3434
}
3535
}
@@ -83,13 +83,13 @@ pub(crate) fn derive_native_class(derive_input: &DeriveInput) -> Result<TokenStr
8383
#with_default
8484
#with_hint
8585
#with_usage
86-
.with_ref_getter(|this: &#name, _owner: ::gdnative::TRef<Self::Base>| {
86+
.with_ref_getter(|this: &#name, _owner: ::gdnative::object::TRef<Self::Base>| {
8787
#before_get
8888
let res = &this.#ident;
8989
#after_get
9090
res
9191
})
92-
.with_setter(|this: &mut #name, _owner: ::gdnative::TRef<Self::Base>, v| {
92+
.with_setter(|this: &mut #name, _owner: ::gdnative::object::TRef<Self::Base>, v| {
9393
#before_set
9494
this.#ident = v;
9595
#after_set
@@ -105,7 +105,7 @@ pub(crate) fn derive_native_class(derive_input: &DeriveInput) -> Result<TokenStr
105105
None
106106
} else {
107107
Some(quote! {
108-
fn init(owner: ::gdnative::TRef<Self::Base>) -> Self {
108+
fn init(owner: ::gdnative::object::TRef<Self::Base>) -> Self {
109109
Self::new(::gdnative::nativescript::OwnerArg::from_safe_ref(owner))
110110
}
111111
})

gdnative/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,14 @@
5151
5252
// TODO: add logo using #![doc(html_logo_url = "https://<url>")]
5353

54-
// Workaround: rustdoc currently shows hidden items in the original crate when they are
55-
// re-exported. Manually re-exporting the public items works around that.
54+
// Workaround (rustdoc 1.55):
55+
// Items, which are #[doc(hidden)] in their original crate and re-exported with a wildcard, lose
56+
// their hidden status. Re-exporting them manually and hiding the wildcard solves this.
5657
#[doc(inline)]
5758
pub use gdnative_core::{
5859
core_types, godot_dbg, godot_error, godot_gdnative_init, godot_gdnative_terminate, godot_init,
5960
godot_nativescript_init, godot_print, godot_warn, godot_wrap_method, nativescript, object,
60-
ref_kind, thread_access, GodotObject, GodotResult, NewRef, Null, Ref, TRef,
61+
ref_kind, thread_access,
6162
};
6263

6364
#[doc(hidden)]

gdnative/tests/ui/derive_fail_methods_missing_new.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ error[E0599]: no function or associated item named `new` found for struct `Foo`
1010
= help: items from traits can only be used if the trait is implemented and in scope
1111
= note: the following traits define an item `new`, perhaps you need to implement one of them:
1212
candidate #1: `UserData`
13-
candidate #2: `gdnative::GodotObject`
13+
candidate #2: `gdnative::prelude::GodotObject`
1414
candidate #3: `PtrWrapper`
1515
candidate #4: `glam::core::traits::matrix::Matrix2x2`
1616
candidate #5: `glam::core::traits::vector::MaskVector2`

0 commit comments

Comments
 (0)