Files
picolog/src/prover/tracing.rs
2026-02-09 11:00:53 +01:00

64 lines
1.1 KiB
Rust

use std::{default, 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 begin_proof(&self, proof_type: ProofType) -> Self;
fn print_step<T: Display>(&self, show: T);
fn end_proof(self);
}
pub struct SimpleTracer
{
proof_type: ProofType,
}
impl SimpleTracer
{
pub fn new(proof_type: ProofType) -> Self
{
Self { proof_type }
}
}
impl Tracer for SimpleTracer
{
fn begin_proof(&self, proof_type: ProofType) -> Self
{
SimpleTracer { proof_type }
}
fn print_step<T: Display>(&self, show: T)
{
let str = format!("{}", self.proof_type);
info!(target: &str, "{}", show);
}
fn end_proof(self)
{
todo!()
}
}