pub struct PolymorphicEnumInnerBuild { name: String, members: Vec, rules: Vec, } impl PolymorphicEnumInnerBuild { pub fn new( name: &str, members: Vec, rules: Vec, ) -> Self { Self { name: name.to_string(), members, rules, } } pub fn name(&self) -> &str { &self.name } pub fn members(&self) -> impl Iterator { self.members.iter() } pub fn rules(&self) -> impl Iterator { self.rules.iter() } } pub struct PolymorphicEnumInnerBuildMember { name: String, kind: PolymorphicEnumInnerBuildMemberKind, } impl PolymorphicEnumInnerBuildMember { pub fn new(name: &str, kind: PolymorphicEnumInnerBuildMemberKind) -> Self { Self { name: name.to_string(), kind, } } pub fn name(&self) -> &str { &self.name } pub fn kind(&self) -> &PolymorphicEnumInnerBuildMemberKind { &self.kind } } pub enum PolymorphicEnumInnerBuildMemberKind { Leaf, Struct, } pub struct PolymorphicEnumInnerBuildRule { name: String, with: String, } impl PolymorphicEnumInnerBuildRule { pub fn new(name: &str, with: &str) -> Self { Self { name: name.to_string(), with: with.to_string(), } } pub fn name(&self) -> &str { &self.name } pub fn with(&self) -> &str { &self.with } }