You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Summary
Cleans the code up a bit, moves reflect base constructors into that
type, and guarantees that typeid always corresponds to a valid reflect
type
Copy file name to clipboardExpand all lines: crates/bevy_mod_scripting_core/src/bindings/reference.rs
+71-30
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,7 @@ use std::{any::TypeId, fmt::Debug};
33
33
/// Bindings defined on this type, apply to ALL references.
34
34
#[derive(Debug,Clone,PartialEq,Eq,Reflect)]
35
35
#[reflect(Default, opaque)]
36
+
#[non_exhaustive]
36
37
pubstructReflectReference{
37
38
/// The base type and id of the value we want to access
38
39
pubbase:ReflectBaseType,
@@ -124,45 +125,27 @@ impl ReflectReference {
124
125
value:Box<dynPartialReflect>,
125
126
allocator:&mutReflectAllocator,
126
127
) -> Result<ReflectReference,InteropError>{
127
-
match value.get_represented_type_info(){
128
-
Some(i) => {
129
-
let id = allocator.allocate_boxed(value);
130
-
Ok(ReflectReference{
131
-
base:ReflectBaseType{
132
-
type_id: i.type_id(),
133
-
base_id:ReflectBase::Owned(id),
134
-
},
135
-
reflect_path:ParsedPath(Vec::default()),
136
-
})
137
-
}
138
-
None => Err(InteropError::unsupported_operation(None,Some(value),"Tried to create a reference to a partial reflect value with no represented type info")),
0 commit comments