diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-12-13 02:57:05 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-12-13 02:57:05 -0500 |
commit | f7e3f34adfbe3a9ff2adb92fe094ef9dff4c5dbb (patch) | |
tree | a4ec3255473f5d9af733bdedf849a932f7f80975 | |
parent | 40a943a422623f0533fbac40285164709b86b5a0 (diff) | |
download | nbsh-f7e3f34adfbe3a9ff2adb92fe094ef9dff4c5dbb.tar.gz nbsh-f7e3f34adfbe3a9ff2adb92fe094ef9dff4c5dbb.zip |
this is actually pretty unnecessary
-rw-r--r-- | src/main.rs | 1 | ||||
-rw-r--r-- | src/state/history.rs | 9 | ||||
-rw-r--r-- | src/util.rs | 5 |
3 files changed, 5 insertions, 10 deletions
diff --git a/src/main.rs b/src/main.rs index 22af8ca..da1facf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,6 @@ mod event; mod format; mod parse; mod state; -mod util; use async_std::stream::StreamExt as _; use textmode::Textmode as _; diff --git a/src/state/history.rs b/src/state/history.rs index 048c1c7..be61423 100644 --- a/src/state/history.rs +++ b/src/state/history.rs @@ -5,7 +5,7 @@ use std::os::unix::process::ExitStatusExt as _; pub struct History { size: (u16, u16), - entries: Vec<crate::util::Mutex<Entry>>, + entries: Vec<async_std::sync::Arc<async_std::sync::Mutex<Entry>>>, scroll_pos: usize, } @@ -87,8 +87,9 @@ impl History { let (exe, args) = crate::parse::cmd(cmd); let (input_w, input_r) = async_std::channel::unbounded(); let (resize_w, resize_r) = async_std::channel::unbounded(); - let entry = - crate::util::mutex(Entry::new(cmd, self.size, input_w, resize_w)); + let entry = async_std::sync::Arc::new(async_std::sync::Mutex::new( + Entry::new(cmd, self.size, input_w, resize_w), + )); if crate::builtins::is(&exe) { let code: i32 = crate::builtins::run(&exe, &args).into(); entry.lock_arc().await.exit_info = Some(ExitInfo::new( @@ -492,7 +493,7 @@ impl ExitInfo { fn run_process( mut child: pty_process::async_std::Child, - entry: crate::util::Mutex<Entry>, + entry: async_std::sync::Arc<async_std::sync::Mutex<Entry>>, input_r: async_std::channel::Receiver<Vec<u8>>, resize_r: async_std::channel::Receiver<(u16, u16)>, event_w: async_std::channel::Sender<crate::event::Event>, diff --git a/src/util.rs b/src/util.rs deleted file mode 100644 index d792b91..0000000 --- a/src/util.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub type Mutex<T> = async_std::sync::Arc<async_std::sync::Mutex<T>>; - -pub fn mutex<T>(t: T) -> Mutex<T> { - async_std::sync::Arc::new(async_std::sync::Mutex::new(t)) -} |