Clean up tokio::sync::mpsc imports

macos-click-through
mforsb 3 years ago committed by Keith Simmons
parent e343c64d4e
commit 8779a76fb0

@ -14,7 +14,7 @@ use nvim_rs::UiAttachOptions;
use rmpv::Value;
use tokio::process::Command;
use tokio::runtime::Runtime;
use tokio::sync::mpsc;
use tokio::sync::mpsc::UnboundedReceiver;
use crate::channel_utils::*;
use crate::settings::*;
@ -156,7 +156,7 @@ fn connection_mode() -> ConnectionMode {
async fn start_neovim_runtime(
ui_command_sender: LoggingTx<UiCommand>,
mut ui_command_receiver: mpsc::UnboundedReceiver<UiCommand>,
mut ui_command_receiver: UnboundedReceiver<UiCommand>,
redraw_event_sender: LoggingTx<RedrawEvent>,
running: Arc<AtomicBool>,
) {
@ -317,7 +317,7 @@ pub struct Bridge {
pub fn start_bridge(
ui_command_sender: LoggingTx<UiCommand>,
ui_command_receiver: mpsc::UnboundedReceiver<UiCommand>,
ui_command_receiver: UnboundedReceiver<UiCommand>,
redraw_event_sender: LoggingTx<RedrawEvent>,
running: Arc<AtomicBool>,
) -> Bridge {

@ -2,7 +2,7 @@ use std::fmt::Debug;
use std::sync::mpsc::{SendError, Sender};
use log::trace;
use tokio::sync::mpsc;
use tokio::sync::mpsc::{error::SendError as TokioSendError, UnboundedSender};
#[derive(Clone)]
pub struct LoggingSender<T>
@ -35,7 +35,7 @@ pub struct LoggingTx<T>
where
T: Debug,
{
tx: mpsc::UnboundedSender<T>,
tx: UnboundedSender<T>,
channel_name: String,
}
@ -43,11 +43,11 @@ impl<T> LoggingTx<T>
where
T: Debug,
{
pub fn attach(tx: mpsc::UnboundedSender<T>, channel_name: String) -> Self {
pub fn attach(tx: UnboundedSender<T>, channel_name: String) -> Self {
Self { tx, channel_name }
}
pub fn send(&self, message: T) -> Result<(), mpsc::error::SendError<T>> {
pub fn send(&self, message: T) -> Result<(), TokioSendError<T>> {
trace!("{} {:?}", self.channel_name, &message);
self.tx.send(message)
}

@ -9,7 +9,7 @@ use std::sync::Arc;
use std::thread;
use log::{error, trace};
use tokio::sync::mpsc;
use tokio::sync::mpsc::UnboundedReceiver;
use crate::bridge::{EditorMode, GuiOption, RedrawEvent, WindowAnchor};
use crate::channel_utils::*;
@ -440,7 +440,7 @@ impl Editor {
}
pub fn start_editor(
mut redraw_event_receiver: mpsc::UnboundedReceiver<RedrawEvent>,
mut redraw_event_receiver: UnboundedReceiver<RedrawEvent>,
batched_draw_command_sender: LoggingSender<Vec<DrawCommand>>,
window_command_sender: LoggingSender<WindowCommand>,
) {

@ -31,7 +31,7 @@ extern crate lazy_static;
use std::sync::{atomic::AtomicBool, mpsc::channel, Arc};
use tokio::sync::mpsc;
use tokio::sync::mpsc::unbounded_channel;
use bridge::start_bridge;
use cmd_line::CmdLineSettings;
@ -136,7 +136,7 @@ fn main() {
let running = Arc::new(AtomicBool::new(true));
let (redraw_event_sender, redraw_event_receiver) = mpsc::unbounded_channel();
let (redraw_event_sender, redraw_event_receiver) = unbounded_channel();
let logging_redraw_event_sender =
LoggingTx::attach(redraw_event_sender, "redraw_event".to_owned());
@ -146,7 +146,7 @@ fn main() {
"batched_draw_command".to_owned(),
);
let (ui_command_sender, ui_command_receiver) = mpsc::unbounded_channel();
let (ui_command_sender, ui_command_receiver) = unbounded_channel();
let logging_ui_command_sender = LoggingTx::attach(ui_command_sender, "ui_command".to_owned());
let (window_command_sender, window_command_receiver) = channel();

Loading…
Cancel
Save