2023-09-27 17:51:03 +02:00
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
pub enum Types {
|
|
|
|
String,
|
|
|
|
Bool,
|
|
|
|
F32, F64,
|
|
|
|
I8, I16, I32, I64,
|
|
|
|
U8, U16, U32, U64,
|
2023-10-01 13:15:12 +02:00
|
|
|
Array(Box<Types>),
|
|
|
|
Optional(Box<Types>),
|
2023-09-27 17:51:03 +02:00
|
|
|
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,
|
2023-10-01 13:15:12 +02:00
|
|
|
pub ty: Types
|
2023-09-27 17:51:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Default)]
|
|
|
|
pub struct StructTy {
|
|
|
|
pub name: String,
|
|
|
|
pub fields: Vec<FieldTy>
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Default)]
|
|
|
|
pub struct MethodTy {
|
|
|
|
pub name: String,
|
|
|
|
pub args: Vec<FieldTy>,
|
2023-10-01 13:15:12 +02:00
|
|
|
pub ret: Option<Types>,
|
2023-09-27 17:51:03 +02:00
|
|
|
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>
|
|
|
|
}
|