pub trait Table:
Sized
+ Send
+ Sync
+ 'static {
type Generator: TableGenerator<Self>;
const TABLE_TYPE: PosTableType;
// Required methods
fn generate(seed: &PosSeed) -> Self;
fn find_proof(&self, challenge_index: u32) -> Option<PosProof>;
fn is_proof_valid(
seed: &PosSeed,
challenge_index: u32,
proof: &PosProof,
) -> bool;
// Provided methods
fn generate_parallel(seed: &PosSeed) -> Self { ... }
fn generator() -> Self::Generator { ... }
}
Expand description
Proof of space kind
Required Associated Constants§
sourceconst TABLE_TYPE: PosTableType
const TABLE_TYPE: PosTableType
Proof of space table type
Required Associated Types§
sourcetype Generator: TableGenerator<Self>
type Generator: TableGenerator<Self>
Instance that can be used to generate tables with better performance
Required Methods§
sourcefn generate(seed: &PosSeed) -> Self
fn generate(seed: &PosSeed) -> Self
Generate new table with 32 bytes seed.
There is also Self::generate_parallel()
that can achieve lower latency.
sourcefn find_proof(&self, challenge_index: u32) -> Option<PosProof>
fn find_proof(&self, challenge_index: u32) -> Option<PosProof>
Try to find proof at challenge_index
if it exists
sourcefn is_proof_valid(
seed: &PosSeed,
challenge_index: u32,
proof: &PosProof,
) -> bool
fn is_proof_valid( seed: &PosSeed, challenge_index: u32, proof: &PosProof, ) -> bool
Check whether proof created earlier is valid and return quality bytes if yes
Provided Methods§
sourcefn generate_parallel(seed: &PosSeed) -> Self
fn generate_parallel(seed: &PosSeed) -> Self
Generate new table with 32 bytes seed using parallelism.
This implementation will trade efficiency of CPU and memory usage for lower latency, prefer
Self::generate()
unless lower latency is critical.
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.