/ src / workers / downloader.rs
downloader.rs
 1  use loco_rs::prelude::*;
 2  use serde::{Deserialize, Serialize};
 3  
 4  pub struct DownloadWorker {
 5      pub ctx: AppContext,
 6  }
 7  
 8  #[derive(Deserialize, Debug, Serialize)]
 9  pub struct DownloadWorkerArgs {
10      pub user_guid: String,
11  }
12  
13  #[async_trait]
14  impl BackgroundWorker<DownloadWorkerArgs> for DownloadWorker {
15      fn build(ctx: &AppContext) -> Self {
16          Self { ctx: ctx.clone() }
17      }
18      async fn perform(&self, _args: DownloadWorkerArgs) -> Result<()> {
19          // TODO: Some actual work goes here...
20  
21          Ok(())
22      }
23  }