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
This commit is contained in:
Erick Z 2025-06-17 00:09:15 +02:00 committed by GitHub
parent c0fa10b0c3
commit 20781371e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -282,6 +282,7 @@ impl GetTypeRegistration for &'static str {
let mut registration = TypeRegistration::of::<Self>();
registration.insert::<ReflectFromPtr>(FromType::<Self>::from_type());
registration.insert::<ReflectFromReflect>(FromType::<Self>::from_type());
registration.insert::<ReflectSerialize>(FromType::<Self>::from_type());
registration
}
}