pub trait Mod {
// Required methods
fn mod_reveal() -> Cow<'static, [u8]>;
fn mod_hash() -> TreeHash;
// Provided method
fn curry_tree_hash(&self) -> TreeHash
where Self: Sized + ToClvm<TreeHasher> { ... }
}Expand description
This trait makes it possible to get the mod hash or puzzle reveal of a puzzle.
There is also a utility for calculating the curried tree hash, provided the type
implements ToTreeHash. This is much more efficient than
manually allocating and hashing the puzzle and its arguments.
This trait should be be implemented for types that represent the curried arguments of puzzles.
However, if a puzzle can’t be curried (ie it has no arguments), this trait can still be
implemented on a marker struct that doesn’t implement ToTreeHash.
This will disable the curry_tree_hash method.
§Usage Example
We can specify the arguments of a puzzle to get its curried puzzle hash.
let args = StandardArgs::new(PublicKey::default());
let puzzle_hash = args.curry_tree_hash();Required Methods§
Provided Methods§
Sourcefn curry_tree_hash(&self) -> TreeHash
fn curry_tree_hash(&self) -> TreeHash
Curry the arguments into the Mod::mod_hash.
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.