aboutsummaryrefslogtreecommitdiffstats
path: root/src/errors.rs
diff options
context:
space:
mode:
authorBrooks J Rady <b.j.rady@gmail.com>2020-12-29 16:28:34 +0000
committerBrooks J Rady <b.j.rady@gmail.com>2020-12-29 16:28:34 +0000
commitb0c7259266f21652944cf1c74eb42682d9c28fa1 (patch)
tree1f58fef33d79652ead2f421d8a0d3e71926de77b /src/errors.rs
parentMove some wasm code to it's own module (diff)
downloadsl0ppij-b0c7259266f21652944cf1c74eb42682d9c28fa1.tar.gz
sl0ppij-b0c7259266f21652944cf1c74eb42682d9c28fa1.tar.xz
sl0ppij-b0c7259266f21652944cf1c74eb42682d9c28fa1.zip
It's now possible to load WASM files from layouts!
Diffstat (limited to 'src/errors.rs')
-rw-r--r--src/errors.rs26
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,