@@ -9,13 +9,23 @@ use super::{
9
9
access_map:: {
10
10
AccessCount , AccessMapKey , AnyAccessMap , DynamicSystemMeta , ReflectAccessId ,
11
11
ReflectAccessKind , SubsetAccessMap ,
12
- } , function:: {
12
+ } ,
13
+ function:: {
13
14
namespace:: Namespace ,
14
15
script_function:: { AppScriptFunctionRegistry , DynamicScriptFunction , FunctionCallContext } ,
15
- } , pretty_print:: DisplayWithWorld , schedule:: AppScheduleRegistry , script_value:: ScriptValue , with_global_access, AppReflectAllocator , ReflectBase , ReflectBaseType , ReflectReference , ScriptComponentRegistration , ScriptResourceRegistration , ScriptTypeRegistration , Union
16
+ } ,
17
+ pretty_print:: DisplayWithWorld ,
18
+ schedule:: AppScheduleRegistry ,
19
+ script_value:: ScriptValue ,
20
+ with_global_access, AppReflectAllocator , AppScriptComponentRegistry , ReflectBase ,
21
+ ReflectBaseType , ReflectReference , ScriptComponentRegistration , ScriptResourceRegistration ,
22
+ ScriptTypeRegistration , Union ,
16
23
} ;
17
24
use crate :: {
18
- bindings:: { function:: { from:: FromScript , from_ref:: FromScriptRef } , with_access_read, with_access_write} ,
25
+ bindings:: {
26
+ function:: { from:: FromScript , from_ref:: FromScriptRef } ,
27
+ with_access_read, with_access_write,
28
+ } ,
19
29
error:: InteropError ,
20
30
reflection_extensions:: PartialReflectExt ,
21
31
} ;
@@ -73,6 +83,8 @@ pub(crate) struct WorldAccessGuardInner<'w> {
73
83
function_registry : AppScriptFunctionRegistry ,
74
84
/// The schedule registry for the world
75
85
schedule_registry : AppScheduleRegistry ,
86
+ /// The registry of script registered components
87
+ script_component_registry : AppScriptComponentRegistry ,
76
88
}
77
89
78
90
impl std:: fmt:: Debug for WorldAccessGuardInner < ' _ > {
@@ -542,7 +554,6 @@ impl<'w> WorldAccessGuard<'w> {
542
554
/// Impl block for higher level world methods
543
555
#[ profiling:: all_functions]
544
556
impl WorldAccessGuard < ' _ > {
545
-
546
557
fn construct_from_script_value (
547
558
& self ,
548
559
descriptor : impl Into < Cow < ' static , str > > ,
@@ -812,8 +823,16 @@ impl WorldAccessGuard<'_> {
812
823
}
813
824
814
825
/// get a type erased type registration for the type including information about whether it's a component or resource
815
- pub ( crate ) fn get_type_registration ( & self , registration : ScriptTypeRegistration ) -> Result < Union < ScriptTypeRegistration , Union < ScriptComponentRegistration , ScriptResourceRegistration > > , InteropError > {
816
-
826
+ pub ( crate ) fn get_type_registration (
827
+ & self ,
828
+ registration : ScriptTypeRegistration ,
829
+ ) -> Result <
830
+ Union <
831
+ ScriptTypeRegistration ,
832
+ Union < ScriptComponentRegistration , ScriptResourceRegistration > ,
833
+ > ,
834
+ InteropError ,
835
+ > {
817
836
let registration = match self . get_resource_type ( registration) ? {
818
837
Ok ( res) => {
819
838
return Ok ( Union :: new_right ( Union :: new_right ( res) ) ) ;
@@ -831,14 +850,23 @@ impl WorldAccessGuard<'_> {
831
850
Ok ( Union :: new_left ( registration) )
832
851
}
833
852
834
- /// Similar to [`Self::get_type_by_name`] but returns a type erased [`ScriptTypeRegistration`], [`ScriptComponentRegistration`] or [`ScriptResourceRegistration`]
853
+ /// Similar to [`Self::get_type_by_name`] but returns a type erased [`ScriptTypeRegistration`], [`ScriptComponentRegistration`] or [`ScriptResourceRegistration`]
835
854
/// depending on the underlying type and state of the world.
836
- pub fn get_type_registration_by_name ( & self , type_name : String ) -> Result < Option < Union < ScriptTypeRegistration , Union < ScriptComponentRegistration , ScriptResourceRegistration > > > , InteropError > {
855
+ pub fn get_type_registration_by_name (
856
+ & self ,
857
+ type_name : String ,
858
+ ) -> Result <
859
+ Option <
860
+ Union <
861
+ ScriptTypeRegistration ,
862
+ Union < ScriptComponentRegistration , ScriptResourceRegistration > ,
863
+ > ,
864
+ > ,
865
+ InteropError ,
866
+ > {
837
867
let val = self . get_type_by_name ( type_name) ;
838
868
Ok ( match val {
839
- Some ( registration) => {
840
- Some ( self . get_type_registration ( registration) ?)
841
- }
869
+ Some ( registration) => Some ( self . get_type_registration ( registration) ?) ,
842
870
None => None ,
843
871
} )
844
872
}
0 commit comments