gfxmath_vec4/impls/hash/
hash.rs

1use core::hash::Hash;
2use crate::Vec4;
3
4
5impl Hash for Vec4<f32> {
6    fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
7        let s = self.as_slice();
8
9        s.iter().for_each(|i| {
10            unsafe { (*(i as *const _ as *const u32)).hash(state) };
11        });
12    }
13}
14
15impl Hash for Vec4<f64> {
16    fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
17        let s = self.as_slice();
18
19        s.iter().for_each(|i| {
20            unsafe { (*(i as *const _ as *const u32)).hash(state) };
21        });
22    }
23}
24
25impl Hash for Vec4<i32> {
26    fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
27        let s = self.as_slice();
28        s.iter().for_each(|i| { i.hash(state); });
29    }
30}
31
32impl Hash for Vec4<i64> {
33    fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
34        let s = self.as_slice();
35        s.iter().for_each(|i| { i.hash(state); });
36    }
37}
38
39impl Hash for Vec4<u32> {
40    fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
41        let s = self.as_slice();
42        s.iter().for_each(|i| { i.hash(state); });
43    }
44}
45
46impl Hash for Vec4<u64> {
47    fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
48        let s = self.as_slice();
49        s.iter().for_each(|i| { i.hash(state); });
50    }
51}