From 547b1c7a7a98bd4dd20577206c98167664c61b3a Mon Sep 17 00:00:00 2001 From: Zachary Harrold Date: Tue, 3 Sep 2024 08:35:17 +1000 Subject: [PATCH] Reflect `SmolStr`'s `De/Serialize` implementation (#14982) # Objective - Fixes #14969 ## Solution - Added `Deserialize` to the list of reflected traits for `SmolStr` ## Testing - CI passed locally. --------- Co-authored-by: Alice Cecile --- crates/bevy_reflect/Cargo.toml | 2 +- crates/bevy_reflect/src/impls/smol_str.rs | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/bevy_reflect/Cargo.toml b/crates/bevy_reflect/Cargo.toml index 5cfbf833009fe..65ded3f8deb6b 100644 --- a/crates/bevy_reflect/Cargo.toml +++ b/crates/bevy_reflect/Cargo.toml @@ -37,7 +37,7 @@ smallvec = { version = "1.11", optional = true } glam = { version = "0.28", features = ["serde"], optional = true } petgraph = { version = "0.6", features = ["serde-1"], optional = true } -smol_str = { version = "0.2.0", optional = true } +smol_str = { version = "0.2.0", features = ["serde"], optional = true } uuid = { version = "1.0", optional = true, features = ["v4", "serde"] } [dev-dependencies] diff --git a/crates/bevy_reflect/src/impls/smol_str.rs b/crates/bevy_reflect/src/impls/smol_str.rs index d8e3251c91d35..d8bd625c1f28f 100644 --- a/crates/bevy_reflect/src/impls/smol_str.rs +++ b/crates/bevy_reflect/src/impls/smol_str.rs @@ -1,8 +1,15 @@ -use crate::std_traits::ReflectDefault; use crate::{self as bevy_reflect}; +use crate::{std_traits::ReflectDefault, ReflectDeserialize, ReflectSerialize}; use bevy_reflect_derive::impl_reflect_value; -impl_reflect_value!(::smol_str::SmolStr(Debug, Hash, PartialEq, Default)); +impl_reflect_value!(::smol_str::SmolStr( + Debug, + Hash, + PartialEq, + Default, + Serialize, + Deserialize, +)); #[cfg(test)] mod tests {