sails-reflect-hash 1.0.0-beta.2

Structural compile-time self-descriptive hash generation for types
Documentation

Structural compile-time hashing for Sails types.

This crate provides the ReflectHash trait which computes a deterministic, name-independent structural hash for types at compile time using const evaluation. This enables unique interface IDs for services based purely on their structure.

Deriving ReflectHash

The easiest way to implement ReflectHash is to derive it:

use sails_reflect_hash::ReflectHash;

#[derive(ReflectHash)]
struct Transfer {
    from: ActorId,
    to: ActorId,
    amount: u128,
}

#[derive(ReflectHash)]
enum Event {
    Transferred { from: ActorId, to: ActorId },
    Approved(ActorId, u128),
    Paused,
}