use anyhow::Result; use tokio::sync::mpsc::{Receiver, Sender}; use crate::model::Mail; struct MailProcessor { rx: Receiver, tx: Sender, } // TODO: Store first then forward. On complete forward remove from db, otherwise save db with the // emails to send to. impl MailProcessor { async fn run(&mut self) -> Result<()> { // TODO: Check againts self.rx.is_closed() instead to stop the program before consuming all // of the queue. Store the emails not yet processed and restore the queue upon startup. while let Some(mail) = self.rx.recv().await { todo!() } Ok(()) } }