Skip to content

Commit

Permalink
Revert "Merge pull request #21 from tuhanayim/refactor/remove-async-t…
Browse files Browse the repository at this point in the history
…rait"

This reverts commit feb6e92, reversing
changes made to 4ed7d93.
  • Loading branch information
catuhana committed Nov 25, 2023
1 parent 4a31b90 commit 5263b7c
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ edition = "2021"

[dependencies]
anyhow = "1.0.75"
async-trait = "0.1.74"
clap = { version = "4.4.8", features = ["derive"] }
confique = { git = "https://github.com/tuhanayim/confique", rev = "2c85724", default-features = false, features = [
"toml",
Expand Down
3 changes: 3 additions & 0 deletions src/platforms/lastfm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub struct LastFM {
pub api_key: String,
}

#[async_trait::async_trait]
pub trait LastFMPlatform: Platform {
const USER_AGENT: &'static str = "reqwest/0.11 [lure]";
const API_URL: &'static str;
Expand All @@ -28,6 +29,7 @@ pub trait LastFMPlatform: Platform {
) -> anyhow::Result<()>;
}

#[async_trait::async_trait]
impl LastFMPlatform for LastFM {
const API_URL: &'static str = "https://ws.audioscrobbler.com/2.0";

Expand All @@ -49,6 +51,7 @@ impl LastFMPlatform for LastFM {
}
}

#[async_trait::async_trait]
impl Platform for LastFM {
type Platform = Self;

Expand Down
1 change: 1 addition & 0 deletions src/platforms/listenbrainz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ impl ListenBrainz {
}
}

#[async_trait::async_trait]
impl Platform for ListenBrainz {
type Platform = Self;

Expand Down
1 change: 1 addition & 0 deletions src/platforms/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub struct Status {
pub idle: Option<String>,
}

#[async_trait::async_trait]
pub trait Platform {
type Platform;

Expand Down
4 changes: 3 additions & 1 deletion src/rive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ use rive_models::{
user::{FieldsUser, UserStatus},
};

#[async_trait::async_trait]
pub trait ClientExt {
async fn ping(&self) -> anyhow::Result<(), anyhow::Error>;
async fn set_status(&self, status: Option<String>);
async fn set_status(&self, status: Option<String>) -> ();
}

#[async_trait::async_trait]
impl ClientExt for Client {
async fn ping(&self) -> anyhow::Result<(), anyhow::Error> {
tracing::debug!("pinging Revolt API");
Expand Down

0 comments on commit 5263b7c

Please sign in to comment.