pub trait TrivialCommitment<T = Value> {
// Required methods
fn hasher(&self) -> fn(&[u8]) -> CommitmentResult<String>;
fn candidate_data(&self) -> &[u8] ⓘ;
fn decode_candidate_data(&self) -> fn(&[u8]) -> CommitmentResult<Value>;
fn to_commitment(
self: Box<Self>,
expected_data: T,
) -> Box<dyn Commitment<T>>;
// Provided methods
fn filter(&self) -> Option<Box<dyn Fn(&Value) -> CommitmentResult<Value>>> { ... }
fn hash(&self) -> CommitmentResult<String> { ... }
fn commitment_content(&self) -> CommitmentResult<Value> { ... }
}
Expand description
A cryptographic commitment with no expected data content.
Required Methods§
Sourcefn hasher(&self) -> fn(&[u8]) -> CommitmentResult<String>
fn hasher(&self) -> fn(&[u8]) -> CommitmentResult<String>
Gets the hasher (as a function pointer).
Sourcefn candidate_data(&self) -> &[u8] ⓘ
fn candidate_data(&self) -> &[u8] ⓘ
Gets the candidate data.
Sourcefn decode_candidate_data(&self) -> fn(&[u8]) -> CommitmentResult<Value>
fn decode_candidate_data(&self) -> fn(&[u8]) -> CommitmentResult<Value>
Gets the candidate data decoder (function).
Sourcefn to_commitment(self: Box<Self>, expected_data: T) -> Box<dyn Commitment<T>>
fn to_commitment(self: Box<Self>, expected_data: T) -> Box<dyn Commitment<T>>
Converts this TrivialCommitment to a Commitment.
Provided Methods§
Sourcefn filter(&self) -> Option<Box<dyn Fn(&Value) -> CommitmentResult<Value>>>
fn filter(&self) -> Option<Box<dyn Fn(&Value) -> CommitmentResult<Value>>>
A closure for filtering candidate data. By default there is no filtering.
Sourcefn hash(&self) -> CommitmentResult<String>
fn hash(&self) -> CommitmentResult<String>
Computes the hash (commitment). This method should not be overridden by implementors.
Sourcefn commitment_content(&self) -> CommitmentResult<Value>
fn commitment_content(&self) -> CommitmentResult<Value>
Gets the data content that the hash verifiably commits to. This method should not be overridden by implementors.