1use crate::{
4 Slot,
5 printer::{IRPrintable, IRPrinterCtx},
6};
7use std::fmt::Write;
8
9impl IRPrintable for Slot {
10 fn fmt(&self, ctx: &mut IRPrinterCtx<'_, '_>) -> crate::printer::Result {
11 match self {
12 Slot::Arg(arg_no) => write!(ctx, "(input {arg_no})"),
13 Slot::Output(field_id) => write!(ctx, "(output {field_id})"),
14 Slot::Advice(cell_ref) => {
15 write!(ctx, "(advice {cell_ref})")
16 }
17 Slot::Fixed(cell_ref) => write!(ctx, "(fixed {cell_ref})"),
18 Slot::TableLookup(id, col, row, idx, region) => {
19 write!(ctx, "(lookup {id} {col} {row} {idx} {region})")
20 }
21 Slot::CallOutput(call, idx) => write!(ctx, "(call-result {call} {idx})"),
22 Slot::Temp(temp) => write!(ctx, "(temp {})", *temp),
23 Slot::Challenge(index, phase, _) => write!(ctx, "(challenge {index} {phase})"),
24 }
25 }
26}