Expand description
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,
}Traits§
- Reflect
Hash - Core trait for computing structural compile-time hashes.
Derive Macros§
- Reflect
Hash - Derives the
ReflectHashtrait for structs and enums.