RawHash

Trait RawHash 

Source
pub trait RawHash {
    // Required method
    unsafe fn raw_hash(ptr: *const c_void) -> u64;

    // Provided method
    fn raw_hash_cb(    ) -> Unsafe<&'static (dyn Fn(*const c_void) -> u64 + Sync + Send + 'static)> { ... }
}
Expand description

Trait implemented automatically for types that implement Hash and can be used compute a u64 hash for a type using a pointer to it.

Required Methods§

Source

unsafe fn raw_hash(ptr: *const c_void) -> u64

Get the hash of the type.

§Safety

The pointer must be aligned, readable, and be a pointer to the type that this Hash function was created for.

Provided Methods§

Source

fn raw_hash_cb() -> Unsafe<&'static (dyn Fn(*const c_void) -> u64 + Sync + Send + 'static)>

Get a callback suitable for SchemaData.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: Hash> RawHash for T