Skip to content

Commit 2078137

Browse files
authored
Register ReflectSerialize for &'static str (#19680)
# Objective - When trying to serialize an structure that contains `&'static str` using only Reflection, I get the following error: ``` "type `&str` did not register the `ReflectSerialize` or `ReflectSerializeWithRegistry` type data. For certain types, this may need to be registered manually using `register_type_data` (stack: ... -> `core::option::Option<&str>` -> `&str`)") ``` ## Solution - Register `ReflectSerialize` for `&str` ## Testing - `cargo run -p ci`: OK
1 parent c0fa10b commit 2078137

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

crates/bevy_reflect/src/impls/core/primitives.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ impl GetTypeRegistration for &'static str {
282282
let mut registration = TypeRegistration::of::<Self>();
283283
registration.insert::<ReflectFromPtr>(FromType::<Self>::from_type());
284284
registration.insert::<ReflectFromReflect>(FromType::<Self>::from_type());
285+
registration.insert::<ReflectSerialize>(FromType::<Self>::from_type());
285286
registration
286287
}
287288
}

0 commit comments

Comments
 (0)