Skip to content

Commit 99687d7

Browse files
committed
Move 'Export' up from 'property'
1 parent 23404e7 commit 99687d7

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

gdnative-core/src/nativescript/export.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use std::ffi::CString;
3939
use std::marker::PhantomData;
4040
use std::ptr;
4141

42-
use crate::core_types::{GodotString, Variant};
42+
use crate::core_types::{GodotString, ToVariant, Variant};
4343
use crate::nativescript::{user_data::UserData, NativeClass, NativeClassMethods};
4444
use crate::object::{GodotObject, NewRef, TRef};
4545
use crate::private::get_api;
@@ -53,7 +53,22 @@ pub mod property;
5353
pub use self::method::{
5454
Method, MethodBuilder, RpcMode, ScriptMethod, ScriptMethodAttributes, ScriptMethodFn, Varargs,
5555
};
56-
pub use self::property::{Export, ExportInfo, PropertyBuilder, Usage as PropertyUsage};
56+
pub use self::property::{ExportInfo, PropertyBuilder, Usage as PropertyUsage};
57+
58+
/// Trait for exportable types.
59+
pub trait Export: ToVariant {
60+
/// A type-specific hint type that is valid for the type being exported.
61+
///
62+
/// If this type shows up as `NoHint`, a private, uninhabitable type indicating
63+
/// that there are no hints available for the time being, users *must* use `None`
64+
/// for properties of this type. This ensures that it will not be a breaking change
65+
/// to add a hint for the type later, since it supports no operations and cannot
66+
/// be named directly in user code.
67+
type Hint;
68+
69+
/// Returns `ExportInfo` given an optional typed hint.
70+
fn export_info(hint: Option<Self::Hint>) -> ExportInfo;
71+
}
5772

5873
/// A handle that can register new classes to the engine during initialization.
5974
///

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

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,14 @@ use crate::object::GodotObject;
77
use crate::object::Ref;
88
use crate::private::get_api;
99

10-
use super::ClassBuilder;
10+
use super::{ClassBuilder, Export};
11+
use accessor::{Getter, InvalidGetter, InvalidSetter, RawGetter, RawSetter, Setter};
1112

1213
mod accessor;
1314
mod hint;
1415

1516
pub use hint::*;
1617

17-
use accessor::{Getter, InvalidGetter, InvalidSetter, RawGetter, RawSetter, Setter};
18-
19-
/// Trait for exportable types.
20-
pub trait Export: ToVariant {
21-
/// A type-specific hint type that is valid for the type being exported.
22-
///
23-
/// If this type shows up as `NoHint`, a private, uninhabitable type indicating
24-
/// that there are no hints available for the time being, users *must* use `None`
25-
/// for properties of this type. This ensures that it will not be a breaking change
26-
/// to add a hint for the type later, since it supports no operations and cannot
27-
/// be named directly in user code.
28-
type Hint;
29-
30-
/// Returns `ExportInfo` given an optional typed hint.
31-
fn export_info(hint: Option<Self::Hint>) -> ExportInfo;
32-
}
33-
3418
/// Metadata about the exported property.
3519
#[derive(Debug)]
3620
pub struct ExportInfo {

0 commit comments

Comments
 (0)