mux: Mux is now Send+Sync
This commit is contained in:
11 files changed
+128
-126
No files matched your search
@@ -9,7 +9,7 @@ use mux::window::{Window, WindowId};
|
||||
use mux::Mux;
|
||||
use portable_pty::CommandBuilder;
|
||||
use std::collections::HashMap;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use wezterm_dynamic::{FromDynamic, ToDynamic};
|
||||
use wezterm_term::TerminalSize;
|
||||
|
||||
@@ -21,7 +21,7 @@ pub use pane::MuxPane;
|
||||
pub use tab::MuxTab;
|
||||
pub use window::MuxWindow;
|
||||
|
||||
fn get_mux() -> mlua::Result<Rc<Mux>> {
|
||||
fn get_mux() -> mlua::Result<Arc<Mux>> {
|
||||
Mux::get()
|
||||
.ok_or_else(|| mlua::Error::external("cannot get Mux: not running on the mux thread?"))
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::sync::Arc;
|
||||
pub struct MuxPane(pub PaneId);
|
||||
|
||||
impl MuxPane {
|
||||
pub fn resolve<'a>(&self, mux: &'a Rc<Mux>) -> mlua::Result<Arc<dyn Pane>> {
|
||||
pub fn resolve<'a>(&self, mux: &'a Arc<Mux>) -> mlua::Result<Arc<dyn Pane>> {
|
||||
mux.get_pane(self.0)
|
||||
.ok_or_else(|| mlua::Error::external(format!("pane id {} not found in mux", self.0)))
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::sync::Arc;
|
||||
pub struct MuxTab(pub TabId);
|
||||
|
||||
impl MuxTab {
|
||||
pub fn resolve<'a>(&self, mux: &'a Rc<Mux>) -> mlua::Result<Arc<Tab>> {
|
||||
pub fn resolve<'a>(&self, mux: &'a Arc<Mux>) -> mlua::Result<Arc<Tab>> {
|
||||
mux.get_tab(self.0)
|
||||
.ok_or_else(|| mlua::Error::external(format!("tab id {} not found in mux", self.0)))
|
||||
}
|
||||
|
||||
@@ -5,14 +5,17 @@ use parking_lot::{MappedRwLockReadGuard, MappedRwLockWriteGuard};
|
||||
pub struct MuxWindow(pub WindowId);
|
||||
|
||||
impl MuxWindow {
|
||||
pub fn resolve<'a>(&self, mux: &'a Rc<Mux>) -> mlua::Result<MappedRwLockReadGuard<'a, Window>> {
|
||||
pub fn resolve<'a>(
|
||||
&self,
|
||||
mux: &'a Arc<Mux>,
|
||||
) -> mlua::Result<MappedRwLockReadGuard<'a, Window>> {
|
||||
mux.get_window(self.0)
|
||||
.ok_or_else(|| mlua::Error::external(format!("window id {} not found in mux", self.0)))
|
||||
}
|
||||
|
||||
pub fn resolve_mut<'a>(
|
||||
&self,
|
||||
mux: &'a Rc<Mux>,
|
||||
mux: &'a Arc<Mux>,
|
||||
) -> mlua::Result<MappedRwLockWriteGuard<'a, Window>> {
|
||||
mux.get_window_mut(self.0)
|
||||
.ok_or_else(|| mlua::Error::external(format!("window id {} not found in mux", self.0)))
|
||||
|
||||
Reference in new issue
Block a user