Skip to content

Commit d672c2d

Browse files
committed
Move thread_access -> object::ownership, ref_kind -> object::memory
1 parent e82e35f commit d672c2d

File tree

19 files changed

+36
-33
lines changed

19 files changed

+36
-33
lines changed

bindings_generator/src/api.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ impl Ty {
448448
Ty::VariantOperator => syn::parse_quote! { VariantOperator },
449449
Ty::Enum(path) => syn::parse_quote! { #path },
450450
Ty::Object(path) => {
451-
syn::parse_quote! { Option<Ref<#path, thread_access::Shared>> }
451+
syn::parse_quote! { Option<Ref<#path, ownership::Shared>> }
452452
}
453453
}
454454
}
@@ -597,7 +597,7 @@ impl Ty {
597597
Ty::Object(ref path) => {
598598
quote! {
599599
ptr::NonNull::new(ret)
600-
.map(|sys| <Ref<#path, thread_access::Shared>>::move_from_sys(sys))
600+
.map(|sys| <Ref<#path, ownership::Shared>>::move_from_sys(sys))
601601
}
602602
}
603603
Ty::Result => {

bindings_generator/src/special_methods.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ destroying the object) or destroyed manually using `Ref::free`, or preferably
2626
quote! {
2727
#[doc=#documentation]
2828
#[inline]
29-
pub fn new() -> Ref<Self, thread_access::Unique> {
29+
pub fn new() -> Ref<Self, ownership::Unique> {
3030
unsafe {
3131
let gd_api = get_api();
3232
let ctor = #method_table::get(gd_api).class_constructor.unwrap();
@@ -42,17 +42,17 @@ pub fn generate_godot_object_impl(class: &GodotClass) -> TokenStream {
4242
let name = &class.name;
4343
let class_name = format_ident!("{}", class.name);
4444

45-
let ref_kind = if class.is_refcounted() {
46-
quote! { ref_kind::RefCounted }
45+
let memory = if class.is_refcounted() {
46+
quote! { memory::RefCounted }
4747
} else {
48-
quote! { ref_kind::ManuallyManaged }
48+
quote! { memory::ManuallyManaged }
4949
};
5050

5151
quote! {
5252
impl gdnative_core::private::godot_object::Sealed for #class_name {}
5353

5454
unsafe impl GodotObject for #class_name {
55-
type RefKind = #ref_kind;
55+
type RefKind = #memory;
5656

5757
#[inline]
5858
fn class_name() -> &'static str {
@@ -69,7 +69,7 @@ pub fn generate_instantiable_impl(class: &GodotClass) -> TokenStream {
6969
quote! {
7070
impl Instanciable for #class_name {
7171
#[inline]
72-
fn construct() -> Ref<Self, thread_access::Unique> {
72+
fn construct() -> Ref<Self, ownership::Unique> {
7373
#class_name::new()
7474
}
7575
}

gdnative-bindings/src/generated.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ use std::sync::Once;
88

99
use gdnative_core::core_types::*;
1010
use gdnative_core::object::*;
11+
use gdnative_core::object::{memory, ownership};
1112
use gdnative_core::private::get_api;
12-
use gdnative_core::ref_kind;
1313
use gdnative_core::sys;
1414
use gdnative_core::sys::GodotApi;
15-
use gdnative_core::thread_access;
1615

1716
include!(concat!(env!("OUT_DIR"), "/generated.rs"));

gdnative-bindings/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
33
use super::generated::{Engine, Node, SceneTree};
44
use gdnative_core::nativescript::{NativeClass, RefInstance};
5+
use gdnative_core::object::ownership::Shared;
56
use gdnative_core::object::{SubClass, TRef};
6-
use gdnative_core::thread_access::Shared;
77

88
/// Convenience method to obtain a reference to an "auto-load" node, that is a child of the root
99
/// node. Returns `None` if the node does not exist or is not of the correct type.

gdnative-core/src/core_types/dictionary.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::core_types::VariantArray;
1515
use crate::object::NewRef;
1616
use std::fmt;
1717

18-
use crate::thread_access::*;
18+
use crate::object::ownership::*;
1919

2020
/// A reference-counted `Dictionary` of `Variant` key-value pairs.
2121
///

gdnative-core/src/core_types/variant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use std::mem::{forget, transmute};
55
use std::ptr;
66

77
use crate::core_types::*;
8+
use crate::object::ownership::*;
89
use crate::object::*;
910
use crate::private::{get_api, ManuallyManagedClassPlaceholder};
10-
use crate::thread_access::*;
1111

1212
#[cfg(feature = "serde")]
1313
mod serialize;

gdnative-core/src/core_types/variant_array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::core_types::ToVariant;
1111
use crate::core_types::Variant;
1212
use crate::object::NewRef;
1313

14-
use crate::thread_access::*;
14+
use crate::object::ownership::*;
1515

1616
use std::fmt;
1717

gdnative-core/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ pub mod nativescript;
4545
#[doc(hidden)]
4646
pub mod log;
4747
pub mod object;
48-
pub mod ref_kind;
49-
pub mod thread_access;
5048

5149
/// Internal low-level API for use by macros and generated bindings. Not a part of the public API.
5250
#[doc(hidden)]
@@ -58,6 +56,6 @@ pub mod private;
5856

5957
pub use init::{InitializeInfo, TerminateInfo};
6058

61-
#[deprecated(since = "0.10", note = "use core_types::GodotResult")]
59+
#[deprecated(since = "0.10.0", note = "use core_types::GodotResult")]
6260
#[doc(hidden)]
6361
pub type GodotResult = core_types::GodotResult;

gdnative-core/src/nativescript/class.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ use crate::core_types::{
55
};
66
use crate::nativescript::init::ClassBuilder;
77
use crate::nativescript::{Map, MapMut, MapOwned, UserData};
8+
use crate::object::memory::{ManuallyManaged, RefCounted};
9+
use crate::object::ownership::{NonUniqueThreadAccess, Shared, ThreadAccess, ThreadLocal, Unique};
810
use crate::object::{
911
AssumeSafeLifetime, LifetimeConstraint, QueueFree, RawObject, Ref, RefImplBound, SafeAsRaw,
1012
SafeDeref, TRef,
1113
};
1214
use crate::object::{GodotObject, Instanciable};
1315
use crate::private::{get_api, ReferenceCountedClassPlaceholder};
14-
use crate::ref_kind::{ManuallyManaged, RefCounted};
15-
use crate::thread_access::{NonUniqueThreadAccess, Shared, ThreadAccess, ThreadLocal, Unique};
1616

1717
use super::class_registry;
1818
use super::emplace;

gdnative-core/src/nativescript/init/method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use std::marker::PhantomData;
1010
use crate::core_types::{FromVariant, FromVariantError, Variant};
1111
use crate::log::Site;
1212
use crate::nativescript::class::{NativeClass, RefInstance};
13+
use crate::object::ownership::Shared;
1314
use crate::object::{Ref, TRef};
14-
use crate::thread_access::Shared;
1515

1616
use super::ClassBuilder;
1717

0 commit comments

Comments
 (0)