Skip to main content

rajac_types/
ident.rs

1use crate::TypeId;
2use rajac_base::shared_string::SharedString;
3use std::fmt::{Display, Formatter};
4
5#[derive(Debug, Clone, PartialEq)]
6pub struct Ident {
7    pub name: SharedString,
8}
9
10impl Ident {
11    pub fn new(name: SharedString) -> Self {
12        Self { name }
13    }
14
15    pub fn as_str(&self) -> &str {
16        self.name.as_str()
17    }
18}
19
20impl Display for Ident {
21    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
22        f.write_str(self.as_str())
23    }
24}
25
26#[derive(Debug, Clone, PartialEq)]
27pub struct TypeParam {
28    pub name: Ident,
29    pub bounds: Vec<TypeId>,
30}