bevy_networker_multiplayer/
netmsg.rs1use serde::{de::DeserializeOwned, Serialize};
3
4pub trait NetMessage:
8 Serialize + DeserializeOwned + Clone + Send + Sync + 'static
9{
10 const TYPE_PATH: &'static str;
12 const WIRE_ID: u64;
14}
15
16pub const fn hash_type_path(type_path: &str) -> u64 {
18 let bytes = type_path.as_bytes();
19 let mut hash: u64 = 0xcbf29ce484222325;
20 let mut index = 0;
21 while index < bytes.len() {
22 hash ^= bytes[index] as u64;
23 hash = hash.wrapping_mul(0x100000001b3);
24 index += 1;
25 }
26 hash
27}