use crate::lang::FunctionId;
use crate::lang::TypeId;
use crate::lang::functions::Signature;
use interoptopus::lang::meta::Emission;
#[derive(Debug, PartialEq, Eq)]
pub enum InterfaceKind {
Plugin,
Service,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum MethodKind {
Regular,
Static,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ResultKind {
Try(TypeId),
Passthrough(TypeId),
}
impl ResultKind {
#[must_use]
pub fn type_id(self) -> TypeId {
match self {
Self::Try(id) | Self::Passthrough(id) => id,
}
}
}
#[derive(Debug, PartialEq, Eq)]
pub struct Method {
pub name: String,
pub kind: MethodKind,
pub base: FunctionId,
pub csharp: Signature,
pub rval_id: TypeId,
pub is_async: bool,
pub result: Option<ResultKind>,
}
#[derive(Debug, PartialEq, Eq)]
pub struct Interface {
pub name: String,
pub emission: Emission,
pub kind: InterfaceKind,
pub methods: Vec<Method>,
}