Fixes infinite loop
This commit is contained in:
55
src/prover/tracing.rs
Normal file
55
src/prover/tracing.rs
Normal file
@ -0,0 +1,55 @@
|
||||
use std::fmt::Display;
|
||||
|
||||
use log::info;
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum ProofType
|
||||
{
|
||||
Body,
|
||||
And,
|
||||
Predicate,
|
||||
}
|
||||
|
||||
impl Display for ProofType
|
||||
{
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result
|
||||
{
|
||||
match self
|
||||
{
|
||||
ProofType::Body => write!(f, "body_prover"),
|
||||
ProofType::And => write!(f, "and_prover"),
|
||||
ProofType::Predicate => write!(f, "predicate_prover"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Tracer
|
||||
{
|
||||
fn next_step(&mut self, proof_type: ProofType) -> Self;
|
||||
fn milestone<T: Display>(&self, str: T);
|
||||
fn explain<T: Display>(&self, str: T);
|
||||
}
|
||||
|
||||
pub struct SimpleTracer
|
||||
{
|
||||
proof_type: ProofType,
|
||||
}
|
||||
|
||||
impl Tracer for SimpleTracer
|
||||
{
|
||||
fn next_step(&mut self, proof_type: ProofType) -> Self
|
||||
{
|
||||
SimpleTracer { proof_type }
|
||||
}
|
||||
|
||||
fn explain<T: Display>(&self, str: T)
|
||||
{
|
||||
let proof_str = format!("{}", self.proof_type);
|
||||
info!(target: &proof_str, "{}", str);
|
||||
}
|
||||
|
||||
fn milestone<T: Display>(&self, str: T)
|
||||
{
|
||||
self.explain(str);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user