luckperms_rs/models/
node.rs

1#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
2pub struct Node {
3    pub key: String,
4    #[serde(rename = "type")]
5    pub type_: NodeType,
6    pub value: bool,
7    pub context: Vec<String>,
8    pub expiry: Option<u64>,
9}
10
11#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
12#[serde(rename_all = "snake_case")]
13pub enum NodeType {
14    RegexPermission,
15    Inheritance,
16    Prefix,
17    Suffix,
18    Meta,
19    Weight,
20    DisplayName,
21}
22
23impl NodeType {
24    pub fn to_string(&self) -> String {
25        match self {
26            Self::RegexPermission => "regex_permission".to_string(),
27            Self::Inheritance => "inheritance".to_string(),
28            Self::Prefix => "prefix".to_string(),
29            Self::Suffix => "suffix".to_string(),
30            Self::Meta => "meta".to_string(),
31            Self::Weight => "weight".to_string(),
32            Self::DisplayName => "display_name".to_string(),
33        }
34    }
35}