acir/circuit/opcodes/
function_id.rs

1use serde::{Deserialize, Serialize};
2
3/// Id for the function being called.
4/// Indexes into the table of ACIR function's specified in a [program][crate::circuit::Program]
5#[derive(Clone, Copy, PartialEq, Eq, Debug, Serialize, Deserialize, Hash)]
6#[cfg_attr(feature = "arb", derive(proptest_derive::Arbitrary))]
7#[serde(transparent)]
8pub struct AcirFunctionId(pub u32);
9
10impl AcirFunctionId {
11    pub fn as_usize(&self) -> usize {
12        self.0 as usize
13    }
14}
15
16impl std::fmt::Display for AcirFunctionId {
17    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
18        write!(f, "{}", self.0)
19    }
20}