Trait TrivialCommitment

Source
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§

Source

fn hasher(&self) -> fn(&[u8]) -> CommitmentResult<String>

Gets the hasher (as a function pointer).

Source

fn candidate_data(&self) -> &[u8]

Gets the candidate data.

Source

fn decode_candidate_data(&self) -> fn(&[u8]) -> CommitmentResult<Value>

Gets the candidate data decoder (function).

Source

fn to_commitment(self: Box<Self>, expected_data: T) -> Box<dyn Commitment<T>>

Converts this TrivialCommitment to a Commitment.

Provided Methods§

Source

fn filter(&self) -> Option<Box<dyn Fn(&Value) -> CommitmentResult<Value>>>

A closure for filtering candidate data. By default there is no filtering.

Source

fn hash(&self) -> CommitmentResult<String>

Computes the hash (commitment). This method should not be overridden by implementors.

Source

fn commitment_content(&self) -> CommitmentResult<Value>

Gets the data content that the hash verifiably commits to. This method should not be overridden by implementors.

Implementors§