gesha_rust_types/
enum_def.rs

1use crate::{Definition, EnumMacroImpl, EnumVariant, TypeHeader};
2
3#[derive(Clone, Debug, PartialEq)]
4pub struct EnumDef {
5    pub header: TypeHeader,
6    pub variants: Vec<EnumVariant>,
7    pub macro_impl: Option<EnumMacroImpl>,
8    _hide_default_constructor: bool,
9}
10
11impl EnumDef {
12    pub fn new(
13        header: TypeHeader,
14        variants: Vec<EnumVariant>,
15        macro_impl: Option<EnumMacroImpl>,
16    ) -> Self {
17        Self {
18            header,
19            macro_impl,
20            variants,
21            _hide_default_constructor: true,
22        }
23    }
24}
25
26impl From<EnumDef> for Definition {
27    fn from(this: EnumDef) -> Self {
28        Self::EnumDef(this)
29    }
30}