Skip to content

Commit

Permalink
bevy_reflect: Reflected char (bevyengine#4790)
Browse files Browse the repository at this point in the history
# Objective

`char` isn't reflected.

## Solution

Reflected `char`.

---

## Changelog

* Reflected `char`

## Migration Guide

> List too long to display
  • Loading branch information
MrGVSV authored and exjam committed May 22, 2022
1 parent df21d33 commit 2bad789
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/bevy_reflect/src/impls/std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use std::{
};

impl_reflect_value!(bool(Hash, PartialEq, Serialize, Deserialize));
impl_reflect_value!(char(Hash, PartialEq, Serialize, Deserialize));
impl_reflect_value!(u8(Hash, PartialEq, Serialize, Deserialize));
impl_reflect_value!(u16(Hash, PartialEq, Serialize, Deserialize));
impl_reflect_value!(u32(Hash, PartialEq, Serialize, Deserialize));
Expand All @@ -37,6 +38,7 @@ impl_reflect_value!(Range<T: Serialize + Clone + for<'de> Deserialize<'de> + Sen
impl_reflect_value!(Duration(Hash, PartialEq, Serialize, Deserialize));

impl_from_reflect_value!(bool);
impl_from_reflect_value!(char);
impl_from_reflect_value!(u8);
impl_from_reflect_value!(u16);
impl_from_reflect_value!(u32);
Expand Down Expand Up @@ -552,6 +554,15 @@ mod tests {
assert!(std::time::Duration::ZERO.serializable().is_some());
}

#[test]
fn should_partial_eq_char() {
let a: &dyn Reflect = &'x';
let b: &dyn Reflect = &'x';
let c: &dyn Reflect = &'o';
assert!(a.reflect_partial_eq(b).unwrap_or_default());
assert!(!a.reflect_partial_eq(c).unwrap_or_default());
}

#[test]
fn should_partial_eq_i32() {
let a: &dyn Reflect = &123_i32;
Expand Down

0 comments on commit 2bad789

Please sign in to comment.