diff --git a/torn-api-macros/Cargo.toml b/torn-api-macros/Cargo.toml index 66e7a0e..24c1f04 100644 --- a/torn-api-macros/Cargo.toml +++ b/torn-api-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torn-api-macros" -version = "0.3.1" +version = "0.3.2" edition = "2021" authors = ["Pyrit [2111649]"] license = "MIT" diff --git a/torn-api-macros/src/lib.rs b/torn-api-macros/src/lib.rs index dcf0bbf..3d6f48f 100644 --- a/torn-api-macros/src/lib.rs +++ b/torn-api-macros/src/lib.rs @@ -153,6 +153,12 @@ fn impl_api_category(ast: &syn::DeriveInput) -> TokenStream { } } + impl crate::ApiSelectionResponse for Response { + fn into_inner(self) -> crate::ApiResponse { + self.0 + } + } + impl crate::ApiSelection for #name { type Response = Response; diff --git a/torn-api/Cargo.toml b/torn-api/Cargo.toml index 53d3307..21f2207 100644 --- a/torn-api/Cargo.toml +++ b/torn-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "torn-api" -version = "0.7.1" +version = "0.7.2" edition = "2021" rust-version = "1.75.0" authors = ["Pyrit [2111649]"] diff --git a/torn-api/src/lib.rs b/torn-api/src/lib.rs index 35bceba..28b4a43 100644 --- a/torn-api/src/lib.rs +++ b/torn-api/src/lib.rs @@ -111,8 +111,12 @@ impl ApiResponse { } } +pub trait ApiSelectionResponse: Send + Sync + From + 'static { + fn into_inner(self) -> ApiResponse; +} + pub trait ApiSelection: Send + Sync + 'static { - type Response: From + Send + Sync; + type Response: ApiSelectionResponse; fn raw_value(self) -> &'static str;