54 lines
1.0 KiB
Rust

#[derive(Debug, Clone)]
pub enum Types {
String,
Bool,
F32, F64,
I8, I16, I32, I64,
U8, U16, U32, U64,
Array(Box<Types>),
Optional(Box<Types>),
Named(String),
Generic(String, Box<Types>, proc_macro2::Span)
}
#[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
}
#[derive(Debug, Clone, Default)]
pub struct StructTy {
pub name: String,
pub fields: Vec<FieldTy>,
pub generic_fields: Vec<FieldTy>,
pub generic_name: Option<String>
}
#[derive(Debug, Clone, Default)]
pub struct MethodTy {
pub name: String,
pub args: Vec<FieldTy>,
pub ret: Option<Types>,
pub ret_stream: bool
}
#[derive(Debug, Clone, Default)]
pub struct ServiceTy {
pub name: String,
pub methods: Vec<MethodTy>
}
#[derive(Debug, Clone, Default)]
pub struct RPC {
pub enums: Vec<EnumTy>,
pub structs: Vec<StructTy>,
pub services: Vec<ServiceTy>
}