improv(service): Make output parameter a generic futures Sink
This commit is contained in:
parent
4abe6a894a
commit
07b740a12f
3 changed files with 6 additions and 7 deletions
|
|
@ -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},
|
||||
|
|
|
|||
|
|
@ -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<O> {
|
||||
active_search: Vec<(PluginKey, PluginSearchResult)>,
|
||||
associated_list: HashMap<Indice, Indice>,
|
||||
awaiting_results: HashSet<PluginKey>,
|
||||
last_query: String,
|
||||
no_sort: bool,
|
||||
output: postage::mpsc::Sender<Response>,
|
||||
output: O,
|
||||
plugins: Slab<PluginConnector>,
|
||||
search_scheduled: bool,
|
||||
}
|
||||
|
||||
impl Service {
|
||||
pub fn new(output: postage::mpsc::Sender<Response>) -> Self {
|
||||
impl<O: futures::Sink<Response> + Unpin> Service<O> {
|
||||
pub fn new(output: O) -> Self {
|
||||
Self {
|
||||
active_search: Vec::new(),
|
||||
associated_list: HashMap::new(),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use crate::*;
|
||||
use pop_launcher::*;
|
||||
use postage::mpsc::Sender;
|
||||
use postage::prelude::*;
|
||||
use slab::Slab;
|
||||
use std::borrow::Cow;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue