bevy/crates/bevy_scene/src
Giacomo Stevanato 871c80c103 Add TypeRegistrationDeserializer and remove BorrowedStr (#7094)
# Objective

This a follow-up to #6894, see https://github.com/bevyengine/bevy/pull/6894#discussion_r1045203113

The goal is to avoid cloning any string when getting a `&TypeRegistration` corresponding to a string which is being deserialized. As a bonus code duplication is also reduced.

## Solution

The manual deserialization of a string and lookup into the type registry has been moved into a separate `TypeRegistrationDeserializer` type, which implements `DeserializeSeed` with a `Visitor` that accepts any string with `visit_str`, even ones that may not live longer than that function call.
`BorrowedStr` has been removed since it's no longer used.

---

## Changelog

- The type `TypeRegistrationDeserializer` has been added, which simplifies getting a `&TypeRegistration` while deserializing a string.
2023-01-09 21:57:14 +00:00
..
bundle.rs Add VisibilityBundle and use it to fix gltfs, scenes, and examples (#5335) 2022-07-16 02:47:23 +00:00
dynamic_scene_builder.rs Fix various typos (#7096) 2023-01-06 00:43:30 +00:00
dynamic_scene.rs Allow iterating over with EntityRef over the entire World (#6843) 2022-12-05 22:35:02 +00:00
lib.rs [Fixes #6030] Bevy scene optional serde (#6076) 2022-11-14 23:08:22 +00:00
scene_loader.rs [Fixes #6030] Bevy scene optional serde (#6076) 2022-11-14 23:08:22 +00:00
scene_spawner.rs Fix various typos (#7096) 2023-01-06 00:43:30 +00:00
scene.rs Clean up Fetch code (#4800) 2022-10-28 09:25:50 +00:00
serde.rs Add TypeRegistrationDeserializer and remove BorrowedStr (#7094) 2023-01-09 21:57:14 +00:00