#[derive(Debug, Clone)] pub enum Types { String, Bool, F32, F64, I8, I16, I32, I64, U8, U16, U32, U64, Named(String) } #[derive(Debug, Clone, Default)] pub struct EnumTy { pub name: String, pub values: Vec<(String, usize)> } #[derive(Debug, Clone)] pub struct FieldTy { pub name: String, pub ty: Types, pub optional: bool, pub array: bool } #[derive(Debug, Clone, Default)] pub struct StructTy { pub name: String, pub fields: Vec } #[derive(Debug, Clone, Default)] pub struct MethodTy { pub name: String, pub args: Vec, pub ret: Option, pub ret_stream: bool } #[derive(Debug, Clone, Default)] pub struct ServiceTy { pub name: String, pub methods: Vec } #[derive(Debug, Clone, Default)] pub struct RPC { pub enums: Vec, pub structs: Vec, pub services: Vec } impl FieldTy { pub fn new(ty: Types) -> Self { Self { name: String::new(), ty, optional: false, array: false } } }