File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ use crate::classes::Node;
10
10
use crate :: meta:: GodotConvert ;
11
11
use crate :: obj:: { Gd , GodotClass , Inherits } ;
12
12
use crate :: registry:: property:: Var ;
13
+ use std:: fmt:: { self , Debug , Formatter } ;
13
14
use std:: mem;
14
15
15
16
/// Ergonomic late-initialization container with `ready()` support.
@@ -103,6 +104,7 @@ use std::mem;
103
104
/// }
104
105
/// }
105
106
/// ```
107
+ #[ derive( Debug ) ]
106
108
pub struct OnReady < T > {
107
109
state : InitState < T > ,
108
110
}
@@ -280,3 +282,19 @@ enum InitState<T> {
280
282
AutoInitializing , // needed because state cannot be empty
281
283
Initialized { value : T } ,
282
284
}
285
+
286
+ impl < T : Debug > Debug for InitState < T > {
287
+ fn fmt ( & self , fmt : & mut Formatter < ' _ > ) -> fmt:: Result {
288
+ match self {
289
+ InitState :: ManualUninitialized => fmt. debug_struct ( "ManualUninitialized" ) . finish ( ) ,
290
+ InitState :: AutoPrepared { .. } => {
291
+ fmt. debug_struct ( "AutoPrepared" ) . finish_non_exhaustive ( )
292
+ }
293
+ InitState :: AutoInitializing => fmt. debug_struct ( "AutoInitializing" ) . finish ( ) ,
294
+ InitState :: Initialized { value } => fmt
295
+ . debug_struct ( "Initialized" )
296
+ . field ( "value" , value)
297
+ . finish ( ) ,
298
+ }
299
+ }
300
+ }
You can’t perform that action at this time.
0 commit comments