Remove async-trait crate
Rust 1.75.0 has async traits 🦀🦀🦀
This commit is contained in:
3
Cargo.lock
generated
3
Cargo.lock
generated
@@ -660,10 +660,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "delfin"
|
name = "delfin"
|
||||||
version = "0.2.1"
|
version = "0.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
|
||||||
"bytes",
|
"bytes",
|
||||||
"chrono",
|
"chrono",
|
||||||
"derive_builder",
|
"derive_builder",
|
||||||
|
@@ -10,7 +10,6 @@ gst = ["dep:video_player_gst"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.75"
|
anyhow = "1.0.75"
|
||||||
async-trait = "0.1.75"
|
|
||||||
bytes = "1.5.0"
|
bytes = "1.5.0"
|
||||||
chrono = "0.4.31"
|
chrono = "0.4.31"
|
||||||
derive_builder = "0.12.0"
|
derive_builder = "0.12.0"
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use async_trait::async_trait;
|
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
use jellyfin_api::types::BaseItemDto;
|
use jellyfin_api::types::BaseItemDto;
|
||||||
use relm4::prelude::*;
|
use relm4::prelude::*;
|
||||||
@@ -79,7 +78,6 @@ struct ViewItemsFetcher {
|
|||||||
view: UserView,
|
view: UserView,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
|
||||||
impl Fetcher for ViewItemsFetcher {
|
impl Fetcher for ViewItemsFetcher {
|
||||||
async fn fetch(&self, start_index: usize, limit: usize) -> Result<(Vec<BaseItemDto>, usize)> {
|
async fn fetch(&self, start_index: usize, limit: usize) -> Result<(Vec<BaseItemDto>, usize)> {
|
||||||
self.api_client
|
self.api_client
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
use std::{
|
use std::{
|
||||||
cmp,
|
cmp,
|
||||||
|
future::Future,
|
||||||
|
marker::Send,
|
||||||
sync::{
|
sync::{
|
||||||
atomic::{AtomicUsize, Ordering},
|
atomic::{AtomicUsize, Ordering},
|
||||||
Arc,
|
Arc,
|
||||||
@@ -7,7 +9,6 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::{Error, Result};
|
use anyhow::{Error, Result};
|
||||||
use async_trait::async_trait;
|
|
||||||
use jellyfin_api::types::BaseItemDto;
|
use jellyfin_api::types::BaseItemDto;
|
||||||
use tokio::{sync::mpsc::UnboundedSender, task::JoinHandle};
|
use tokio::{sync::mpsc::UnboundedSender, task::JoinHandle};
|
||||||
|
|
||||||
@@ -152,9 +153,12 @@ impl<F: Fetcher + Send + Sync + 'static> MediaFetcher<F> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
|
||||||
pub trait Fetcher {
|
pub trait Fetcher {
|
||||||
async fn fetch(&self, start_index: usize, limit: usize) -> Result<(Vec<BaseItemDto>, usize)>;
|
fn fetch(
|
||||||
|
&self,
|
||||||
|
start_index: usize,
|
||||||
|
limit: usize,
|
||||||
|
) -> impl Future<Output = Result<(Vec<BaseItemDto>, usize)>> + Send;
|
||||||
|
|
||||||
fn title(&self) -> String;
|
fn title(&self) -> String;
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use async_trait::async_trait;
|
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
use jellyfin_api::types::BaseItemDto;
|
use jellyfin_api::types::BaseItemDto;
|
||||||
use relm4::{adw::traits::ActionRowExt, gtk::traits::BoxExt, prelude::*};
|
use relm4::{adw::traits::ActionRowExt, gtk::traits::BoxExt, prelude::*};
|
||||||
@@ -101,7 +100,6 @@ struct SearchResultsFetcher {
|
|||||||
search_text: String,
|
search_text: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
|
||||||
impl Fetcher for SearchResultsFetcher {
|
impl Fetcher for SearchResultsFetcher {
|
||||||
async fn fetch(&self, start_index: usize, limit: usize) -> Result<(Vec<BaseItemDto>, usize)> {
|
async fn fetch(&self, start_index: usize, limit: usize) -> Result<(Vec<BaseItemDto>, usize)> {
|
||||||
self.api_client
|
self.api_client
|
||||||
|
Reference in New Issue
Block a user