runtime.rs
1use mlua::{FromLua, ToLua};
2
3pub trait FromRuntime: Sized {
4 fn from_runtime() -> Option<Self>;
5}
6
7pub trait Interface {
8 type Handle;
9 fn handles(&self) -> &[Self::Handle];
10}
11
12pub trait Runtime
13where
14 Self: Sized,
15{
16 type Module;
17 type Interface: Interface;
18
19 fn init(plugin: Self::Module) -> Option<Self>;
20 fn interface(&self) -> Self::Interface;
21 fn val<'lua, K: ToLua<'lua>, V: FromLua<'lua>>(&'lua self, key: K) -> Option<V>;
22}