refactor: Replace postage with flume

This commit is contained in:
Michael Aaron Murphy 2022-03-27 16:02:25 +02:00 committed by Michael Murphy
parent 805bf6333e
commit e578f2d19c
11 changed files with 192 additions and 112 deletions

View file

@ -11,8 +11,7 @@ pub use self::help::HelpPlugin;
use crate::{Indice, PluginHelp, Request};
use async_trait::async_trait;
use postage::mpsc::{Receiver, Sender};
use postage::prelude::*;
use flume::{Receiver, Sender};
use regex::Regex;
#[async_trait]
@ -39,8 +38,8 @@ where
async fn quit(&mut self, id: Indice);
async fn run(&mut self, mut rx: Receiver<Request>) {
while let Some(request) = rx.recv().await {
async fn run(&mut self, rx: Receiver<Request>) {
while let Ok(request) = rx.recv_async().await {
tracing::event!(
tracing::Level::DEBUG,
"{}: received {:?}",
@ -130,7 +129,7 @@ impl PluginConnector {
..
} = self;
sender.get_or_insert_with(|| init())
sender.get_or_insert_with(init)
}
/// Drops the sender, which will subsequently drop the plugin forwarder attached to it