From dbc023d761e45891d8ba9085cc78442897475cf5 Mon Sep 17 00:00:00 2001 From: Jeremiah Russell Date: Sat, 11 Oct 2025 06:54:50 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(trash):=20separat?= =?UTF-8?q?e=20trash=20preparation=20and=20execution?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - split the run function into prepare and batch_trash - prepare is for fetching the list, batch_trash will execute the move to trash --- src/trash.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/trash.rs b/src/trash.rs index 1057ba7..2a7e513 100644 --- a/src/trash.rs +++ b/src/trash.rs @@ -20,14 +20,18 @@ impl Trash { &mut self.message_list } - /// Run the trash cli - pub async fn run(&mut self, pages: u32) -> Result<()> { + /// Prepare the trash cli + pub async fn prepare(&mut self, pages: u32) -> Result<()> { self.message_list.run(pages).await?; - self.batch_move_to_trash().await?; Ok(()) } + /// Move the messages to trash + pub async fn batch_trash(&self) -> Result<()> { + self.batch_move_to_trash().await + } + async fn batch_move_to_trash(&self) -> Result<()> { let add_label_ids = Some(Vec::from(["TRASH".to_string()])); let ids = Some(self.message_list.message_ids());