Moved client to separate thread.
All checks were successful
MoreThanText/morethantext/pipeline/head This commit looks good

This commit is contained in:
2025-03-27 07:18:19 -04:00
parent 9615b49da2
commit 577abba5ab
2 changed files with 112 additions and 15 deletions

View File

@ -1,31 +1,28 @@
mod client;
mod field;
use client::{Client, Reply, Request};
use field::Field;
pub struct Reply;
impl Reply {
pub fn get_session(&self) -> String {
"id".to_string()
}
pub fn get_content(&self) -> String {
"Something goes here.".to_string()
}
}
use std::sync::mpsc::{channel, Sender};
#[derive(Clone)]
pub struct MoreThanText;
pub struct MoreThanText {
tx: Sender<Request>,
}
impl MoreThanText {
pub fn new() -> Self {
Self {}
let tx = Client::start();
Self { tx: tx }
}
pub fn request<F>(&self, _session: Option<F>) -> Reply
where
F: Into<Field>,
{
Reply {}
let (tx, rx) = channel();
let req = Request::new(tx);
self.tx.send(req).unwrap();
rx.recv().unwrap()
}
}