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