acir/circuit/opcodes/
function_id.rs

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