2 Commits
1.4.2 ... 1.4.3

Author SHA1 Message Date
cd558eebfa Added From<T> for BaseResponse 2024-08-14 20:37:10 +02:00
347314460a Sanitize impl in macro 2024-08-05 01:49:28 +02:00
5 changed files with 10 additions and 4 deletions

2
Cargo.lock generated
View File

@ -303,7 +303,7 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "lib"
version = "1.4.2"
version = "1.4.3"
dependencies = [
"axum",
"into-response-derive",

View File

@ -10,7 +10,7 @@ homepage = "emberal.github.io"
[package]
name = "lib"
version = "1.4.2"
version = "1.4.3"
description = "A library with utilities and helper fuctions."
edition = { workspace = true }
rust-version = { workspace = true }

View File

@ -7,7 +7,7 @@ pub fn into_response_derive_impl(input: DeriveInput) -> TokenStream {
let name = &input.ident;
let expanded = quote! {
impl IntoResponse for #name {
impl axum::response::IntoResponse for #name {
fn into_response(self) -> axum::response::Response {
let version = env!("CARGO_PKG_VERSION");
lib::serde::response::BaseResponse::new(version, self)

View File

@ -286,7 +286,7 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "lib"
version = "1.4.2"
version = "1.4.3"
dependencies = [
"axum",
"thiserror",

View File

@ -16,6 +16,12 @@ impl<T: Serialize> BaseResponse<T> {
}
}
impl<T: Serialize> From<T> for BaseResponse<T> {
fn from(body: T) -> Self {
Self::new(env!("CARGO_PKG_VERSION"), body)
}
}
#[cfg(test)]
mod tests {
use super::*;