From 2eadcb86a5377381c41e7fa52395a1dbd75f5a84 Mon Sep 17 00:00:00 2001 From: Kyle Sutherland-Cash Date: Sat, 1 May 2021 09:22:21 -0700 Subject: [PATCH] Bit of renaming --- src/common/mod.rs | 16 ++++------------ src/common/wasm_vm.rs | 18 +++++++++--------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/common/mod.rs b/src/common/mod.rs index a05b1280..0990172d 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -550,18 +550,10 @@ pub fn start(mut os_input: Box, opts: CliArgs) { let plugin_env = PluginEnv { plugin_id, - send_pty_instructions: plugin_bus.to_pty.as_ref().unwrap().clone(), - send_screen_instructions: plugin_bus - .to_screen - .as_ref() - .unwrap() - .clone(), - send_app_instructions: plugin_bus.to_app.as_ref().unwrap().clone(), - send_plugin_instructions: plugin_bus - .to_plugin - .as_ref() - .unwrap() - .clone(), + to_pty: plugin_bus.to_pty.as_ref().unwrap().clone(), + to_screen: plugin_bus.to_screen.as_ref().unwrap().clone(), + to_app: plugin_bus.to_app.as_ref().unwrap().clone(), + to_plugin: plugin_bus.to_plugin.as_ref().unwrap().clone(), wasi_env, subscriptions: Arc::new(Mutex::new(HashSet::new())), }; diff --git a/src/common/wasm_vm.rs b/src/common/wasm_vm.rs index f04d4d5f..253f52f7 100644 --- a/src/common/wasm_vm.rs +++ b/src/common/wasm_vm.rs @@ -28,10 +28,10 @@ pub enum PluginInstruction { pub struct PluginEnv { pub plugin_id: u32, // FIXME: This should be a big bundle of all of the channels - pub send_screen_instructions: SenderWithContext, - pub send_app_instructions: SenderWithContext, - pub send_pty_instructions: SenderWithContext, - pub send_plugin_instructions: SenderWithContext, + pub to_screen: SenderWithContext, + pub to_app: SenderWithContext, + pub to_pty: SenderWithContext, + pub to_plugin: SenderWithContext, pub wasi_env: WasiEnv, pub subscriptions: Arc>>, } @@ -77,7 +77,7 @@ fn host_unsubscribe(plugin_env: &PluginEnv) { fn host_set_selectable(plugin_env: &PluginEnv, selectable: i32) { let selectable = selectable != 0; plugin_env - .send_screen_instructions + .to_screen .send(ScreenInstruction::SetSelectable( PaneId::Plugin(plugin_env.plugin_id), selectable, @@ -88,7 +88,7 @@ fn host_set_selectable(plugin_env: &PluginEnv, selectable: i32) { fn host_set_max_height(plugin_env: &PluginEnv, max_height: i32) { let max_height = max_height as usize; plugin_env - .send_screen_instructions + .to_screen .send(ScreenInstruction::SetMaxHeight( PaneId::Plugin(plugin_env.plugin_id), max_height, @@ -99,7 +99,7 @@ fn host_set_max_height(plugin_env: &PluginEnv, max_height: i32) { fn host_set_invisible_borders(plugin_env: &PluginEnv, invisible_borders: i32) { let invisible_borders = invisible_borders != 0; plugin_env - .send_screen_instructions + .to_screen .send(ScreenInstruction::SetInvisibleBorders( PaneId::Plugin(plugin_env.plugin_id), invisible_borders, @@ -118,7 +118,7 @@ fn host_get_plugin_ids(plugin_env: &PluginEnv) { fn host_open_file(plugin_env: &PluginEnv) { let path: PathBuf = wasi_read_object(&plugin_env.wasi_env); plugin_env - .send_pty_instructions + .to_pty .send(PtyInstruction::SpawnTerminal(Some(path))) .unwrap(); } @@ -133,7 +133,7 @@ fn host_set_timeout(plugin_env: &PluginEnv, secs: f64) { // timers as we'd like. // // But that's a lot of code, and this is a few lines: - let send_plugin_instructions = plugin_env.send_plugin_instructions.clone(); + let send_plugin_instructions = plugin_env.to_plugin.clone(); let update_target = Some(plugin_env.plugin_id); thread::spawn(move || { let start_time = Instant::now();