pulsar_frontend/attribute.rs
1// Copyright (C) 2024 Ethan Uppal. All rights reserved.
2
3#[repr(u8)]
4pub enum Attribute {
5 /// Not present in user source.
6 Generated
7}
8
9#[derive(Default, PartialEq, Eq, Clone, Copy)]
10pub struct Attributes {
11 bitmap: u16
12}
13
14impl Attributes {
15 pub fn add(&mut self, attr: Attribute) {
16 self.bitmap |= 1 << (attr as u8);
17 }
18
19 pub fn has(&self, attr: Attribute) -> bool {
20 self.bitmap & (1 << (attr as u8)) != 0
21 }
22}