diff options
| author | Brooks Rady <b.j.rady@gmail.com> | 2020-12-30 11:41:02 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-30 11:41:02 +0000 |
| commit | c7db38d0c5ff1c41d9194cc76d1c2d5a18a7b079 (patch) | |
| tree | 870c1377eea53eb2069285726f8f17de2e7e81c4 /src/errors.rs | |
| parent | fix(plugins): fully Working WebAssembly Loading! (#125) (diff) | |
| parent | Merge things (diff) | |
| download | sl0ppij-c7db38d0c5ff1c41d9194cc76d1c2d5a18a7b079.tar.gz sl0ppij-c7db38d0c5ff1c41d9194cc76d1c2d5a18a7b079.tar.xz sl0ppij-c7db38d0c5ff1c41d9194cc76d1c2d5a18a7b079.zip | |
Merge pull request #126 from mosaic-org/wasm-launchable
Load WASM from Layouts (Includes PR #125)
Diffstat (limited to 'src/errors.rs')
| -rw-r--r-- | src/errors.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/errors.rs b/src/errors.rs index f2e68058..e4788e20 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -101,6 +101,8 @@ impl Display for ErrorContext { pub enum ContextType { Screen(ScreenContext), Pty(PtyContext), + #[cfg(feature = "wasm-wip")] + Plugin(PluginContext), App(AppContext), IPCServer, StdinHandler, @@ -115,6 +117,8 @@ impl Display for ContextType { match *self { ContextType::Screen(c) => write!(f, "{}screen_thread: {}{:?}", purple, green, c), ContextType::Pty(c) => write!(f, "{}pty_thread: {}{:?}", purple, green, c), + #[cfg(feature = "wasm-wip")] + ContextType::Plugin(c) => write!(f, "{}plugin_thread: {}{:?}", purple, green, c), ContextType::App(c) => write!(f, "{}main_thread: {}{:?}", purple, green, c), ContextType::IPCServer => write!(f, "{}ipc_server: {}AcceptInput", purple, green), ContextType::StdinHandler => { @@ -220,6 +224,28 @@ impl From<&PtyInstruction> for PtyContext { } } +// FIXME: This whole pattern *needs* a macro eventually, it's soul-crushing to write +#[cfg(feature = "wasm-wip")] +use crate::wasm_vm::PluginInstruction; +#[cfg(feature = "wasm-wip")] +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum PluginContext { + Load, + Unload, + Quit, +} + +#[cfg(feature = "wasm-wip")] +impl From<&PluginInstruction> for PluginContext { + fn from(plugin_instruction: &PluginInstruction) -> Self { + match *plugin_instruction { + PluginInstruction::Load(_) => PluginContext::Load, + PluginInstruction::Unload(_) => PluginContext::Unload, + PluginInstruction::Quit => PluginContext::Quit, + } + } +} + #[derive(Debug, Clone, Copy, PartialEq)] pub enum AppContext { Exit, |
