2025-03-27 07:18:19 -04:00
|
|
|
mod client;
|
2025-03-26 17:42:34 -04:00
|
|
|
mod field;
|
2025-03-29 09:22:53 -04:00
|
|
|
mod queue;
|
2024-05-05 23:18:42 -04:00
|
|
|
|
2025-03-27 07:18:19 -04:00
|
|
|
use client::{Client, Reply, Request};
|
2025-03-26 17:42:34 -04:00
|
|
|
use field::Field;
|
2025-03-27 07:18:19 -04:00
|
|
|
use std::sync::mpsc::{channel, Sender};
|
2025-02-10 08:05:59 -05:00
|
|
|
|
2025-02-22 10:53:05 -05:00
|
|
|
#[derive(Clone)]
|
2025-03-27 07:18:19 -04:00
|
|
|
pub struct MoreThanText {
|
|
|
|
tx: Sender<Request>,
|
|
|
|
}
|
2025-02-22 10:53:05 -05:00
|
|
|
|
2025-03-26 17:42:34 -04:00
|
|
|
impl MoreThanText {
|
|
|
|
pub fn new() -> Self {
|
2025-03-27 07:18:19 -04:00
|
|
|
let tx = Client::start();
|
|
|
|
Self { tx: tx }
|
2025-02-11 11:33:54 -05:00
|
|
|
}
|
|
|
|
|
2025-03-26 17:42:34 -04:00
|
|
|
pub fn request<F>(&self, _session: Option<F>) -> Reply
|
2025-02-11 11:33:54 -05:00
|
|
|
where
|
|
|
|
F: Into<Field>,
|
|
|
|
{
|
2025-03-27 07:18:19 -04:00
|
|
|
let (tx, rx) = channel();
|
|
|
|
let req = Request::new(tx);
|
|
|
|
self.tx.send(req).unwrap();
|
|
|
|
rx.recv().unwrap()
|
2024-11-06 21:28:44 -05:00
|
|
|
}
|
2024-05-05 23:18:42 -04:00
|
|
|
}
|