diff --git a/Cargo.lock b/Cargo.lock index e27b06a..950024b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -660,10 +660,9 @@ dependencies = [ [[package]] name = "delfin" -version = "0.2.1" +version = "0.3.0" dependencies = [ "anyhow", - "async-trait", "bytes", "chrono", "derive_builder", diff --git a/delfin/Cargo.toml b/delfin/Cargo.toml index a49909c..24a38e6 100644 --- a/delfin/Cargo.toml +++ b/delfin/Cargo.toml @@ -10,7 +10,6 @@ gst = ["dep:video_player_gst"] [dependencies] anyhow = "1.0.75" -async-trait = "0.1.75" bytes = "1.5.0" chrono = "0.4.31" derive_builder = "0.12.0" diff --git a/delfin/src/library/collection.rs b/delfin/src/library/collection.rs index 3b3b3cc..8427542 100644 --- a/delfin/src/library/collection.rs +++ b/delfin/src/library/collection.rs @@ -1,7 +1,6 @@ use std::sync::Arc; use anyhow::Result; -use async_trait::async_trait; use gtk::prelude::*; use jellyfin_api::types::BaseItemDto; use relm4::prelude::*; @@ -79,7 +78,6 @@ struct ViewItemsFetcher { view: UserView, } -#[async_trait] impl Fetcher for ViewItemsFetcher { async fn fetch(&self, start_index: usize, limit: usize) -> Result<(Vec, usize)> { self.api_client diff --git a/delfin/src/library/media_fetcher.rs b/delfin/src/library/media_fetcher.rs index d1294f3..c1e798a 100644 --- a/delfin/src/library/media_fetcher.rs +++ b/delfin/src/library/media_fetcher.rs @@ -1,5 +1,7 @@ use std::{ cmp, + future::Future, + marker::Send, sync::{ atomic::{AtomicUsize, Ordering}, Arc, @@ -7,7 +9,6 @@ use std::{ }; use anyhow::{Error, Result}; -use async_trait::async_trait; use jellyfin_api::types::BaseItemDto; use tokio::{sync::mpsc::UnboundedSender, task::JoinHandle}; @@ -152,9 +153,12 @@ impl MediaFetcher { } } -#[async_trait] pub trait Fetcher { - async fn fetch(&self, start_index: usize, limit: usize) -> Result<(Vec, usize)>; + fn fetch( + &self, + start_index: usize, + limit: usize, + ) -> impl Future, usize)>> + Send; fn title(&self) -> String; } diff --git a/delfin/src/library/search/search_results.rs b/delfin/src/library/search/search_results.rs index aacf29e..9897950 100644 --- a/delfin/src/library/search/search_results.rs +++ b/delfin/src/library/search/search_results.rs @@ -1,7 +1,6 @@ use std::sync::Arc; use anyhow::Result; -use async_trait::async_trait; use gtk::prelude::*; use jellyfin_api::types::BaseItemDto; use relm4::{adw::traits::ActionRowExt, gtk::traits::BoxExt, prelude::*}; @@ -101,7 +100,6 @@ struct SearchResultsFetcher { search_text: String, } -#[async_trait] impl Fetcher for SearchResultsFetcher { async fn fetch(&self, start_index: usize, limit: usize) -> Result<(Vec, usize)> { self.api_client