Skip to content

Commit 9c3fbb1

Browse files
committed
Move out symbols from export::{method, property}
1 parent 00e7621 commit 9c3fbb1

File tree

13 files changed

+37
-44
lines changed

13 files changed

+37
-44
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::property::{ArrayHint, IntHint, RangeHint};
1+
use gdnative::nativescript::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::property::{EnumHint, IntHint, StringHint};
4+
use gdnative::nativescript::export::hint::{EnumHint, IntHint, StringHint};
55

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

gdnative-async/src/rt/bridge.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ use parking_lot::Mutex;
66
use gdnative_bindings::{Object, Reference};
77
use gdnative_core::core_types::{GodotError, Variant, VariantArray};
88
use gdnative_core::godot_site;
9-
use gdnative_core::nativescript::export::method::{Method, Varargs};
10-
use gdnative_core::nativescript::export::ClassBuilder;
9+
use gdnative_core::nativescript::export::{ClassBuilder, Method, Varargs};
1110
use gdnative_core::nativescript::user_data::{ArcData, Map};
1211
use gdnative_core::nativescript::{Instance, NativeClass, NativeClassMethods, RefInstance};
1312
use gdnative_core::object::{ownership::Shared, TRef};

gdnative-async/src/rt/func_state.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
use gdnative_bindings::Reference;
22
use gdnative_core::core_types::{ToVariant, Variant, VariantType};
33
use gdnative_core::godot_site;
4-
use gdnative_core::nativescript::export::method::StaticArgs;
5-
use gdnative_core::nativescript::export::method::StaticArgsMethod;
64
use gdnative_core::nativescript::export::{
7-
ClassBuilder, ExportInfo, PropertyUsage, Signal, SignalArgument,
5+
ClassBuilder, ExportInfo, PropertyUsage, Signal, SignalArgument, StaticArgs, StaticArgsMethod,
86
};
9-
use gdnative_core::nativescript::user_data::LocalCellData;
10-
use gdnative_core::nativescript::user_data::{Map, MapMut};
7+
use gdnative_core::nativescript::user_data::{LocalCellData, Map, MapMut};
118
use gdnative_core::nativescript::{Instance, NativeClass, NativeClassMethods, RefInstance};
129
use gdnative_core::object::ownership::{Shared, Unique};
1310
use gdnative_derive::FromVarargs;

gdnative-core/src/nativescript/export.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,26 @@
3333
// Temporary for unsafe method registration
3434
#![allow(deprecated)]
3535

36-
use crate::*;
37-
3836
use std::ffi::CString;
3937
use std::marker::PhantomData;
4038
use std::ptr;
4139

4240
use crate::core_types::{GodotString, ToVariant, Variant};
41+
use crate::nativescript::{class_registry, emplace};
4342
use crate::nativescript::{user_data::UserData, NativeClass, NativeClassMethods};
44-
use crate::object::{GodotObject, NewRef, TRef};
43+
use crate::object::{GodotObject, NewRef, RawObject, TRef};
4544
use crate::private::get_api;
4645

47-
use super::class_registry;
48-
use super::emplace;
46+
pub use method::*;
47+
pub use property::*;
4948

50-
pub mod method;
51-
pub mod property;
49+
mod method;
50+
mod property;
5251

53-
pub use self::method::{
54-
Method, MethodBuilder, RpcMode, ScriptMethod, ScriptMethodAttributes, ScriptMethodFn, Varargs,
55-
};
56-
pub use self::property::{ExportInfo, PropertyBuilder, Usage as PropertyUsage};
52+
//pub use self::method::{
53+
// Method, MethodBuilder, RpcMode, ScriptMethod, ScriptMethodAttributes, ScriptMethodFn, Varargs,
54+
//};
55+
//pub use self::property::{ExportInfo, PropertyBuilder, Usage as PropertyUsage};
5756

5857
/// Trait for exportable types.
5958
pub trait Export: ToVariant {
@@ -139,7 +138,7 @@ impl InitHandle {
139138
}
140139
};
141140

142-
let owner = match object::RawObject::<C::Base>::try_from_sys_ref(this) {
141+
let owner = match RawObject::<C::Base>::try_from_sys_ref(this) {
143142
Some(owner) => owner,
144143
None => {
145144
godot_error!(

gdnative-core/src/nativescript/export/property.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ use super::{ClassBuilder, Export};
1111
use accessor::{Getter, InvalidGetter, InvalidSetter, RawGetter, RawSetter, Setter};
1212

1313
mod accessor;
14-
mod hint;
15-
16-
pub use hint::*;
14+
pub mod hint;
1715

1816
/// Metadata about the exported property.
1917
#[derive(Debug)]
@@ -57,7 +55,7 @@ pub struct PropertyBuilder<'a, C, T: Export, S = InvalidSetter<'a>, G = InvalidG
5755
getter: G,
5856
default: Option<T>,
5957
hint: Option<T::Hint>,
60-
usage: Usage,
58+
usage: PropertyUsage,
6159
class_builder: &'a ClassBuilder<C>,
6260
}
6361

@@ -75,7 +73,7 @@ where
7573
getter: InvalidGetter::new(name),
7674
default: None,
7775
hint: None,
78-
usage: Usage::DEFAULT,
76+
usage: PropertyUsage::DEFAULT,
7977
class_builder,
8078
}
8179
}
@@ -267,14 +265,14 @@ where
267265

268266
/// Sets a property usage.
269267
#[inline]
270-
pub fn with_usage(mut self, usage: Usage) -> Self {
268+
pub fn with_usage(mut self, usage: PropertyUsage) -> Self {
271269
self.usage = usage;
272270
self
273271
}
274272
}
275273

276274
bitflags::bitflags! {
277-
pub struct Usage: u32 {
275+
pub struct PropertyUsage: u32 {
278276
const STORAGE = sys::godot_property_usage_flags_GODOT_PROPERTY_USAGE_STORAGE as u32;
279277
const EDITOR = sys::godot_property_usage_flags_GODOT_PROPERTY_USAGE_EDITOR as u32;
280278
const NETWORK = sys::godot_property_usage_flags_GODOT_PROPERTY_USAGE_NETWORK as u32;
@@ -299,7 +297,7 @@ bitflags::bitflags! {
299297
}
300298
}
301299

302-
impl Usage {
300+
impl PropertyUsage {
303301
#[inline]
304302
pub fn to_sys(self) -> sys::godot_property_usage_flags {
305303
self.bits() as sys::godot_property_usage_flags
@@ -458,7 +456,7 @@ mod impl_export {
458456
}
459457

460458
impl Export for VariantArray<Shared> {
461-
type Hint = ArrayHint;
459+
type Hint = hint::ArrayHint;
462460

463461
#[inline]
464462
fn export_info(hint: Option<Self::Hint>) -> ExportInfo {

gdnative-core/src/nativescript/export/property/hint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use super::{Export, ExportInfo};
1616
/// Basic usage:
1717
///
1818
/// ```rust
19-
/// use gdnative_core::nativescript::export::property::RangeHint;
19+
/// use gdnative_core::nativescript::export::hint::RangeHint;
2020
///
2121
/// let hint: RangeHint<f64> = RangeHint::new(0.0, 20.0).or_greater();
2222
/// ```
@@ -110,7 +110,7 @@ where
110110
/// Basic usage:
111111
///
112112
/// ```rust
113-
/// use gdnative_core::nativescript::export::property::EnumHint;
113+
/// use gdnative_core::nativescript::export::hint::EnumHint;
114114
///
115115
/// let hint = EnumHint::new(vec!["Foo".into(), "Bar".into(), "Baz".into()]);
116116
/// ```

gdnative-core/src/nativescript/macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ macro_rules! godot_wrap_method_inner {
108108
}
109109

110110
#[allow(unused_variables, unused_assignments, unused_mut)]
111-
impl $crate::nativescript::export::method::StaticArgsMethod<$type_name> for ThisMethod {
111+
impl $crate::nativescript::export::StaticArgsMethod<$type_name> for ThisMethod {
112112
type Args = Args;
113113
fn call(
114114
&self,
@@ -139,7 +139,7 @@ macro_rules! godot_wrap_method_inner {
139139
}
140140
}
141141

142-
$crate::nativescript::export::method::StaticArgs::new(ThisMethod)
142+
$crate::nativescript::export::StaticArgs::new(ThisMethod)
143143
}
144144
};
145145
}

gdnative-derive/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ pub fn profiled(meta: TokenStream, input: TokenStream) -> TokenStream {
163163
///
164164
/// ```
165165
/// use gdnative::prelude::*;
166-
/// use gdnative::nativescript::export::property::{RangeHint, FloatHint};
166+
/// use gdnative::nativescript::export::hint::{RangeHint, FloatHint};
167167
///
168168
/// #[derive(NativeClass)]
169169
/// #[inherit(Reference)]

gdnative-derive/src/native_script.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub(crate) fn derive_native_class(derive_input: &DeriveInput) -> Result<TokenStr
5656
let with_hint = config.hint.map(|hint_fn| quote!(.with_hint(#hint_fn())));
5757

5858
let with_usage = if config.no_editor {
59-
Some(quote!(.with_usage(::gdnative::nativescript::export::property::Usage::NOEDITOR)))
59+
Some(quote!(.with_usage(::gdnative::nativescript::export::PropertyUsage::NOEDITOR)))
6060
} else {
6161
None
6262
};

0 commit comments

Comments
 (0)