pulsar_ir/
variable.rs

1// Copyright (C) 2024 Ethan Uppal. All rights reserved.
2use pulsar_utils::id::{Gen, Id};
3use std::fmt::Display;
4
5#[derive(PartialEq, Eq, Hash, Clone, Copy)]
6pub struct Variable {
7    id: Id
8}
9
10impl Variable {
11    pub fn new() -> Self {
12        Self {
13            id: Gen::next("IR variable")
14        }
15    }
16}
17
18impl Display for Variable {
19    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20        write!(f, "i{}", self.id)
21    }
22}