Skip to content

Commit 233b8d0

Browse files
committed
Rename nativescript -> export; move out nativescript::export
1 parent 1b34b7c commit 233b8d0

File tree

35 files changed

+111
-117
lines changed

35 files changed

+111
-117
lines changed

examples/array_export/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use gdnative::nativescript::export::hint::{ArrayHint, IntHint, RangeHint};
1+
use gdnative::export::hint::{ArrayHint, IntHint, RangeHint};
22
use gdnative::prelude::*;
33

44
#[derive(NativeClass)]

examples/spinning_cube/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use gdnative::api::MeshInstance;
22
use gdnative::prelude::*;
33

4-
use gdnative::nativescript::export::hint::{EnumHint, IntHint, StringHint};
4+
use gdnative::export::hint::{EnumHint, IntHint, StringHint};
55

66
#[derive(gdnative::derive::NativeClass)]
77
#[inherit(MeshInstance)]

gdnative-async/src/method.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use std::sync::Arc;
55
use futures_task::{LocalFutureObj, LocalSpawn, SpawnError};
66

77
use gdnative_core::core_types::{ToVariant, Variant};
8+
use gdnative_core::export::{Method, Varargs};
9+
use gdnative_core::export::{NativeClass, RefInstance};
810
use gdnative_core::log::{self, Site};
9-
use gdnative_core::nativescript::export::{Method, Varargs};
10-
use gdnative_core::nativescript::{NativeClass, RefInstance};
1111
use gdnative_core::object::ownership::Shared;
1212

1313
use crate::rt::Context;

gdnative-async/src/rt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use gdnative_bindings::Object;
44
use gdnative_core::object::SubClass;
55

66
use gdnative_core::core_types::{GodotError, Variant};
7-
use gdnative_core::nativescript::export::InitHandle;
8-
use gdnative_core::nativescript::{Instance, RefInstance};
7+
use gdnative_core::export::InitHandle;
8+
use gdnative_core::export::{Instance, RefInstance};
99
use gdnative_core::object::ownership::Shared;
1010
use gdnative_core::object::TRef;
1111

gdnative-async/src/rt/bridge.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use parking_lot::Mutex;
55

66
use gdnative_bindings::{Object, Reference};
77
use gdnative_core::core_types::{GodotError, Variant, VariantArray};
8+
use gdnative_core::export::user_data::{ArcData, Map};
9+
use gdnative_core::export::{ClassBuilder, Method, Varargs};
10+
use gdnative_core::export::{Instance, NativeClass, NativeClassMethods, RefInstance};
811
use gdnative_core::godot_site;
9-
use gdnative_core::nativescript::export::{ClassBuilder, Method, Varargs};
10-
use gdnative_core::nativescript::user_data::{ArcData, Map};
11-
use gdnative_core::nativescript::{Instance, NativeClass, NativeClassMethods, RefInstance};
1212
use gdnative_core::object::{ownership::Shared, TRef};
1313

1414
use crate::future::Resume;

gdnative-async/src/rt/func_state.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use gdnative_bindings::Reference;
22
use gdnative_core::core_types::{ToVariant, Variant, VariantType};
3-
use gdnative_core::godot_site;
4-
use gdnative_core::nativescript::export::{
3+
use gdnative_core::export::user_data::{LocalCellData, Map, MapMut};
4+
use gdnative_core::export::{
55
ClassBuilder, ExportInfo, PropertyUsage, Signal, SignalArgument, StaticArgs, StaticArgsMethod,
66
};
7-
use gdnative_core::nativescript::user_data::{LocalCellData, Map, MapMut};
8-
use gdnative_core::nativescript::{Instance, NativeClass, NativeClassMethods, RefInstance};
7+
use gdnative_core::export::{Instance, NativeClass, NativeClassMethods, RefInstance};
8+
use gdnative_core::godot_site;
99
use gdnative_core::object::ownership::{Shared, Unique};
1010
use gdnative_derive::FromVarargs;
1111

gdnative-bindings/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Utility functions and extension traits that depend on generated bindings
22
33
use super::generated::{Engine, Node, SceneTree};
4-
use gdnative_core::nativescript::{NativeClass, RefInstance};
4+
use gdnative_core::export::{NativeClass, RefInstance};
55
use gdnative_core::object::ownership::Shared;
66
use gdnative_core::object::{SubClass, TRef};
77

gdnative-core/src/nativescript/class.rs renamed to gdnative-core/src/export/class.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use std::ptr::NonNull;
33
use crate::core_types::{
44
FromVariant, FromVariantError, GodotString, OwnedToVariant, ToVariant, Variant,
55
};
6-
use crate::nativescript::export::ClassBuilder;
7-
use crate::nativescript::user_data::{Map, MapMut, MapOwned, UserData};
6+
use crate::export::user_data::{Map, MapMut, MapOwned, UserData};
7+
use crate::export::ClassBuilder;
88
use crate::object::bounds::{
99
AssumeSafeLifetime, LifetimeConstraint, RefImplBound, SafeAsRaw, SafeDeref,
1010
};
@@ -746,7 +746,7 @@ fn try_get_user_data_ptr<T: NativeClass>(owner: &RawObject<T::Base>) -> Option<*
746746
return None;
747747
}
748748

749-
if !crate::nativescript::type_tag::check::<T>(type_tag) {
749+
if !crate::export::type_tag::check::<T>(type_tag) {
750750
return None;
751751
}
752752

gdnative-core/src/nativescript/export.rs renamed to gdnative-core/src/export/class_builder.rs

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -37,38 +37,12 @@ use std::ffi::CString;
3737
use std::marker::PhantomData;
3838
use std::ptr;
3939

40-
use crate::core_types::{GodotString, ToVariant, Variant};
41-
use crate::nativescript::{class_registry, emplace};
42-
use crate::nativescript::{user_data::UserData, NativeClass, NativeClassMethods};
40+
use crate::core_types::{GodotString, Variant};
41+
use crate::export::user_data::UserData;
42+
use crate::export::*;
4343
use crate::object::{GodotObject, NewRef, RawObject, TRef};
4444
use crate::private::get_api;
4545

46-
pub use method::*;
47-
pub use property::*;
48-
49-
mod method;
50-
mod property;
51-
52-
//pub use self::method::{
53-
// Method, MethodBuilder, RpcMode, ScriptMethod, ScriptMethodAttributes, ScriptMethodFn, Varargs,
54-
//};
55-
//pub use self::property::{ExportInfo, PropertyBuilder, Usage as PropertyUsage};
56-
57-
/// Trait for exportable types.
58-
pub trait Export: ToVariant {
59-
/// A type-specific hint type that is valid for the type being exported.
60-
///
61-
/// If this type shows up as `NoHint`, a private, uninhabitable type indicating
62-
/// that there are no hints available for the time being, users *must* use `None`
63-
/// for properties of this type. This ensures that it will not be a breaking change
64-
/// to add a hint for the type later, since it supports no operations and cannot
65-
/// be named directly in user code.
66-
type Hint;
67-
68-
/// Returns `ExportInfo` given an optional typed hint.
69-
fn export_info(hint: Option<Self::Hint>) -> ExportInfo;
70-
}
71-
7246
/// A handle that can register new classes to the engine during initialization.
7347
///
7448
/// See [`godot_nativescript_init`](macro.godot_nativescript_init.html) and
@@ -221,7 +195,7 @@ impl InitHandle {
221195
(get_api().godot_nativescript_set_type_tag)(
222196
self.handle as *mut _,
223197
class_name.as_ptr() as *const _,
224-
crate::nativescript::type_tag::create::<C>(),
198+
crate::export::type_tag::create::<C>(),
225199
);
226200

227201
let builder = ClassBuilder {
@@ -240,8 +214,8 @@ impl InitHandle {
240214

241215
#[derive(Debug)]
242216
pub struct ClassBuilder<C> {
243-
init_handle: *mut libc::c_void,
244-
class_name: CString,
217+
pub(super) init_handle: *mut libc::c_void,
218+
pub(super) class_name: CString,
245219
_marker: PhantomData<C>,
246220
}
247221

@@ -306,7 +280,7 @@ impl<C: NativeClass> ClassBuilder<C> {
306280
/// Basic usage:
307281
/// ```
308282
/// use gdnative::prelude::*;
309-
/// use gdnative::nativescript::export::{RpcMode, Varargs};
283+
/// use gdnative::export::{RpcMode, Varargs};
310284
///
311285
/// #[derive(NativeClass)]
312286
/// #[register_with(Self::my_register)]

gdnative-core/src/nativescript/class_registry.rs renamed to gdnative-core/src/export/class_registry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::nativescript::NativeClass;
1+
use crate::export::NativeClass;
22
use once_cell::sync::Lazy;
33
use parking_lot::RwLock;
44
use std::any::TypeId;

0 commit comments

Comments
 (0)