From 07b740a12f340bde2931e2a4b0f143ae1a3666c2 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Wed, 25 Aug 2021 19:23:51 +0200 Subject: [PATCH] improv(service): Make output parameter a generic futures Sink --- plugins/src/scripts/mod.rs | 1 - service/src/lib.rs | 11 ++++++----- service/src/plugins/help.rs | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/src/scripts/mod.rs b/plugins/src/scripts/mod.rs index 9f262d8..0ecd37c 100644 --- a/plugins/src/scripts/mod.rs +++ b/plugins/src/scripts/mod.rs @@ -6,7 +6,6 @@ use postage::mpsc::Sender; use postage::prelude::*; use smol::process::{Command, Stdio}; use std::collections::VecDeque; -use std::os::unix::process::CommandExt; use std::{ io, path::{Path, PathBuf}, diff --git a/service/src/lib.rs b/service/src/lib.rs index 78e0a2e..c46874a 100644 --- a/service/src/lib.rs +++ b/service/src/lib.rs @@ -1,10 +1,11 @@ mod plugins; use crate::plugins::*; +use futures::SinkExt; use futures_core::Stream; use futures_lite::{future, StreamExt}; use pop_launcher::*; -use postage::{mpsc, prelude::Sink as PostageSink}; +use postage::mpsc; use regex::Regex; use slab::Slab; use std::{ @@ -55,19 +56,19 @@ pub async fn main() { futures_lite::future::zip(service, responder).await; } -pub struct Service { +pub struct Service { active_search: Vec<(PluginKey, PluginSearchResult)>, associated_list: HashMap, awaiting_results: HashSet, last_query: String, no_sort: bool, - output: postage::mpsc::Sender, + output: O, plugins: Slab, search_scheduled: bool, } -impl Service { - pub fn new(output: postage::mpsc::Sender) -> Self { +impl + Unpin> Service { + pub fn new(output: O) -> Self { Self { active_search: Vec::new(), associated_list: HashMap::new(), diff --git a/service/src/plugins/help.rs b/service/src/plugins/help.rs index 79855f6..4d8f677 100644 --- a/service/src/plugins/help.rs +++ b/service/src/plugins/help.rs @@ -1,7 +1,6 @@ use crate::*; use pop_launcher::*; use postage::mpsc::Sender; -use postage::prelude::*; use slab::Slab; use std::borrow::Cow;