bevy_reflect/impls/std/collections/
hash_map.rs

1use bevy_reflect_derive::impl_type_path;
2
3use crate::impls::macros::impl_reflect_for_hashmap;
4#[cfg(feature = "functions")]
5use crate::{
6    from_reflect::FromReflect, type_info::MaybeTyped, type_path::TypePath,
7    type_registry::GetTypeRegistration,
8};
9#[cfg(feature = "functions")]
10use core::hash::{BuildHasher, Hash};
11
12impl_reflect_for_hashmap!(::std::collections::HashMap<K, V, S>);
13impl_type_path!(::std::collections::hash_map::RandomState);
14impl_type_path!(::std::collections::HashMap<K, V, S>);
15
16#[cfg(feature = "functions")]
17crate::func::macros::impl_function_traits!(::std::collections::HashMap<K, V, S>;
18    <
19        K: FromReflect + MaybeTyped + TypePath + GetTypeRegistration + Eq + Hash,
20        V: FromReflect + MaybeTyped + TypePath + GetTypeRegistration,
21        S: TypePath + BuildHasher + Default + Send + Sync
22    >
23);
24
25#[cfg(test)]
26mod tests {
27    use crate::Reflect;
28    use static_assertions::assert_impl_all;
29
30    #[test]
31    fn should_reflect_hashmaps() {
32        assert_impl_all!(std::collections::HashMap<u32, f32>: Reflect);
33    }
34}