1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use serde::Serialize;

#[derive(Serialize, Debug, Clone, Copy, PartialEq)]
pub enum Flag {
    Final,
    Public,
    Protected,
    Private,
    Static,
    Abstract,
}

impl Flag {
    pub fn is_visibility_flag(&self) -> bool {
        match self {
            Flag::Public | Flag::Protected | Flag::Private => true,
            _ => false,
        }
    }
}

pub trait Flaggable {
    fn add_flag(&mut self, flag: Flag);
    fn has_flag(&self, flag: Flag) -> bool;
    fn has_flags(&self) -> bool;
    fn has_visiblity_flag(&self) -> bool;
}