Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bevyengine
GitHub Repository: bevyengine/bevy
Path: blob/main/crates/bevy_reflect/src/impls/std/collections/hash_map.rs
6601 views
1
use bevy_reflect_derive::impl_type_path;
2
3
use crate::impls::macros::impl_reflect_for_hashmap;
4
#[cfg(feature = "functions")]
5
use crate::{
6
from_reflect::FromReflect, type_info::MaybeTyped, type_path::TypePath,
7
type_registry::GetTypeRegistration,
8
};
9
#[cfg(feature = "functions")]
10
use core::hash::{BuildHasher, Hash};
11
12
impl_reflect_for_hashmap!(::std::collections::HashMap<K, V, S>);
13
impl_type_path!(::std::collections::hash_map::RandomState);
14
impl_type_path!(::std::collections::HashMap<K, V, S>);
15
16
#[cfg(feature = "functions")]
17
crate::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)]
26
mod 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
}
35
36