11//! Property registration.
22
3+ use accessor:: { Getter , RawGetter , RawSetter , Setter } ;
4+ use invalid_accessor:: { InvalidGetter , InvalidSetter } ;
5+
36use crate :: core_types:: * ;
47use crate :: nativescript:: { Instance , NativeClass } ;
58use crate :: object:: ownership:: Shared ;
69use crate :: object:: GodotObject ;
710use crate :: object:: Ref ;
811use crate :: private:: get_api;
912
10- use super :: ClassBuilder ;
13+ use super :: { ClassBuilder , Export } ;
1114
1215mod accessor;
13- pub mod hint;
14-
15- pub use hint:: * ;
16-
17- use accessor:: { Getter , InvalidGetter , InvalidSetter , RawGetter , RawSetter , Setter } ;
16+ mod invalid_accessor;
1817
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- }
18+ pub mod hint;
3319
3420/// Metadata about the exported property.
3521#[ derive( Debug ) ]
@@ -73,7 +59,7 @@ pub struct PropertyBuilder<'a, C, T: Export, S = InvalidSetter<'a>, G = InvalidG
7359 getter : G ,
7460 default : Option < T > ,
7561 hint : Option < T :: Hint > ,
76- usage : Usage ,
62+ usage : PropertyUsage ,
7763 class_builder : & ' a ClassBuilder < C > ,
7864}
7965
9177 getter : InvalidGetter :: new ( name) ,
9278 default : None ,
9379 hint : None ,
94- usage : Usage :: DEFAULT ,
80+ usage : PropertyUsage :: DEFAULT ,
9581 class_builder,
9682 }
9783 }
@@ -283,14 +269,14 @@ where
283269
284270 /// Sets a property usage.
285271 #[ inline]
286- pub fn with_usage ( mut self , usage : Usage ) -> Self {
272+ pub fn with_usage ( mut self , usage : PropertyUsage ) -> Self {
287273 self . usage = usage;
288274 self
289275 }
290276}
291277
292278bitflags:: bitflags! {
293- pub struct Usage : u32 {
279+ pub struct PropertyUsage : u32 {
294280 const STORAGE = sys:: godot_property_usage_flags_GODOT_PROPERTY_USAGE_STORAGE as u32 ;
295281 const EDITOR = sys:: godot_property_usage_flags_GODOT_PROPERTY_USAGE_EDITOR as u32 ;
296282 const NETWORK = sys:: godot_property_usage_flags_GODOT_PROPERTY_USAGE_NETWORK as u32 ;
@@ -315,7 +301,7 @@ bitflags::bitflags! {
315301 }
316302}
317303
318- impl Usage {
304+ impl PropertyUsage {
319305 #[ inline]
320306 pub fn to_sys ( self ) -> sys:: godot_property_usage_flags {
321307 self . bits ( ) as sys:: godot_property_usage_flags
@@ -474,7 +460,7 @@ mod impl_export {
474460 }
475461
476462 impl Export for VariantArray < Shared > {
477- type Hint = ArrayHint ;
463+ type Hint = hint :: ArrayHint ;
478464
479465 #[ inline]
480466 fn export_info ( hint : Option < Self :: Hint > ) -> ExportInfo {
0 commit comments