File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
crates/bevy_mod_scripting_bindings/src/conversions Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,7 @@ use bevy_reflect::PartialReflect;
1515/// Note: string ref types cannot be effectively converted into their static reference versions without leaking, so they are not supported here.
1616pub fn convert ( value : & dyn PartialReflect , target : TypeId ) -> Option < Box < dyn PartialReflect > > {
1717 let primitive = Primitive :: from ( value) ;
18- let out = primitive. convert ( target) ;
19- out
18+ primitive. convert ( target)
2019}
2120
2221/// A coercion primitive used for intermediate normalizations.
@@ -268,11 +267,15 @@ impl<'a> From<&'a dyn PartialReflect> for Primitive<'a> {
268267 && let Some ( v) = v. try_downcast_ref :: < f64 > ( )
269268 {
270269 Primitive :: F ( * v)
270+ } else if t == TypeId :: of :: < Cow < ' static , str > > ( )
271+ && let Some ( v) = v. try_downcast_ref :: < Cow < ' static , str > > ( )
272+ {
273+ Primitive :: S ( v. clone ( ) )
271274 } else if t == TypeId :: of :: < String > ( )
272275 && let Some ( v) = v. try_downcast_ref :: < String > ( )
273276 {
274277 Primitive :: S ( Cow :: Borrowed ( v. as_str ( ) ) )
275- } else if t == TypeId :: of :: < String > ( )
278+ } else if t == TypeId :: of :: < & ' static str > ( )
276279 && let Some ( v) = v. try_downcast_ref :: < & ' static str > ( )
277280 {
278281 Primitive :: S ( Cow :: Borrowed ( * v) )
You can’t perform that action at this time.
0 commit comments