Generates TokenStream for struct version hash (computed at compile time).
(fields: &[&Field])
| 827 | |
| 828 | /// Generates TokenStream for struct version hash (computed at compile time). |
| 829 | pub(crate) fn gen_struct_version_hash_ts(fields: &[&Field]) -> TokenStream { |
| 830 | let fingerprint = compute_struct_fingerprint(fields); |
| 831 | let (hash, _) = fory_core::util::murmurhash3_x64_128(fingerprint.as_bytes(), 47); |
| 832 | let version_hash = (hash & 0xFFFF_FFFF) as i32; |
| 833 | |
| 834 | quote! { |
| 835 | { |
| 836 | const VERSION_HASH: i32 = #version_hash; |
| 837 | if fory_core::util::ENABLE_FORY_DEBUG_OUTPUT { |
| 838 | println!( |
| 839 | "[rust][fory-debug] struct {} version fingerprint=\"{}\" hash={}", |
| 840 | ::std::any::type_name::<Self>(), |
| 841 | #fingerprint, |
| 842 | VERSION_HASH |
| 843 | ); |
| 844 | } |
| 845 | VERSION_HASH |
| 846 | } |
| 847 | } |
| 848 | } |
| 849 | |
| 850 | pub(crate) fn is_skip_field(field: &syn::Field) -> bool { |
| 851 | super::field_meta::is_skip_field(field) |
no test coverage detected