#![deny(missing_docs)]
mod console;
mod message;
pub use afrim_translator::Predicate;
use anyhow::Result;
pub use console::Console;
pub use message::Command;
use std::sync::mpsc::{Receiver, Sender};
pub trait Frontend {
fn init(&mut self, _tx: Sender<Command>, _rx: Receiver<Command>) -> Result<()>;
fn listen(&mut self) -> Result<()>;
}
pub struct None;
impl Frontend for None {
fn init(&mut self, _tx: Sender<Command>, _rx: Receiver<Command>) -> Result<()> {
Ok(())
}
fn listen(&mut self) -> Result<()> {
Ok(())
}
}
#[cfg(test)]
mod tests {
use crate::frontend::Frontend;
use std::sync::mpsc;
#[test]
fn test_none() {
use crate::frontend::None;
let mut none = None;
let (tx, rx) = mpsc::channel();
assert!(none.init(tx, rx).is_ok());
assert!(none.listen().is_ok());
}
}