From 4297860b9e2c883d4ca33f5fe2679503237c78bf Mon Sep 17 00:00:00 2001 From: Neshura Date: Tue, 7 May 2024 22:29:48 +0200 Subject: [PATCH] Legacy fixes for async traits --- Cargo.lock | 1 + Cargo.toml | 1 + src/fetchers/jnovel.rs | 2 ++ src/fetchers/mod.rs | 2 ++ 4 files changed, 6 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index aa6f6ca..96888c9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -45,6 +45,7 @@ dependencies = [ name = "aob-lemmy-bot" version = "3.0.0-rc.1" dependencies = [ + "async-trait", "chrono", "confy", "lemmy_api_common", diff --git a/Cargo.toml b/Cargo.toml index 1599c33..9b3d486 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,4 +31,5 @@ confy = "^0.6" toml = "^0.8" systemd-journal-logger = "^2.1.1" log = "^0.4" +async-trait = "^0.1" notify = "6.1.1" \ No newline at end of file diff --git a/src/fetchers/jnovel.rs b/src/fetchers/jnovel.rs index 7ce0a6a..6a7e437 100644 --- a/src/fetchers/jnovel.rs +++ b/src/fetchers/jnovel.rs @@ -3,6 +3,7 @@ use chrono::{DateTime, Duration, Utc}; use serde_derive::{Deserialize, Serialize}; use std::collections::HashMap; use std::ops::Sub; +use async_trait::async_trait; use url::Url; use crate::fetchers::{FetcherTrait}; use crate::lemmy::{PartInfo, PostInfo, PostInfoInner, PostType}; @@ -104,6 +105,7 @@ impl JNovelFetcher { } } +#[async_trait] impl FetcherTrait for JNovelFetcher { fn new() -> Self { JNovelFetcher { diff --git a/src/fetchers/mod.rs b/src/fetchers/mod.rs index 990d7c1..ce05d8a 100644 --- a/src/fetchers/mod.rs +++ b/src/fetchers/mod.rs @@ -1,3 +1,4 @@ +use async_trait::async_trait; use serde_derive::{Deserialize, Serialize}; use strum_macros::Display; use crate::fetchers::Fetcher::Jnc; @@ -6,6 +7,7 @@ use crate::lemmy::{PostInfo}; pub mod jnovel; +#[async_trait] pub(crate) trait FetcherTrait { fn new() -> Self where Self: Sized; async fn check_feed(&self) -> Result, ()>;