acir/circuit/opcodes/
function_id.rs1use msgpack_tagged::MsgpackTagged;
2use serde::{Deserialize, Serialize};
3
4#[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(u32);
11
12impl AcirFunctionId {
13 pub fn new(id: u32) -> Self {
16 AcirFunctionId(id)
17 }
18
19 pub fn as_u32(&self) -> u32 {
20 self.0
21 }
22
23 pub fn as_usize(&self) -> usize {
24 self.0 as usize
25 }
26}
27
28impl std::fmt::Display for AcirFunctionId {
29 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
30 write!(f, "{}", self.0)
31 }
32}