Clean up output
This commit is contained in:
parent
774a5ed4ac
commit
1a11a18d05
7 changed files with 224 additions and 77 deletions
22
src/actions/action.rs
Normal file
22
src/actions/action.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
use crate::models::Magnet;
|
||||
use async_trait::async_trait;
|
||||
use color_eyre::eyre::Result;
|
||||
|
||||
/// Struct to hold the list of processed and failed magnets
|
||||
pub struct ProcessedMagnets {
|
||||
pub success: Vec<Magnet>,
|
||||
pub failed: Vec<Magnet>,
|
||||
}
|
||||
|
||||
/// Trait for actions that process magnet links
|
||||
#[async_trait]
|
||||
pub trait Action {
|
||||
/// Return the name of the action
|
||||
fn name(&self) -> &str;
|
||||
|
||||
/// Process all unprocessed magnet links and return the list of processed magnets
|
||||
async fn process_unprocessed_magnets(
|
||||
&mut self,
|
||||
db: &mut crate::db::Database,
|
||||
) -> Result<ProcessedMagnets>;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue