Added Wrapper types and DateTimeInterval
This commit is contained in:
@ -4,3 +4,5 @@ pub mod load;
|
||||
#[cfg(feature = "serde")]
|
||||
pub mod response;
|
||||
pub mod router;
|
||||
#[cfg(feature = "serde")]
|
||||
pub mod wrappers;
|
||||
|
20
src/axum/wrappers.rs
Normal file
20
src/axum/wrappers.rs
Normal file
@ -0,0 +1,20 @@
|
||||
use axum::response::{IntoResponse, Response};
|
||||
use derive_more::{Constructor, From};
|
||||
use into_response_derive::IntoResponse;
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, From, Constructor)]
|
||||
pub struct Array<T: Serialize> {
|
||||
pub data: Vec<T>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Serialize, IntoResponse, From, Constructor)]
|
||||
pub struct Count {
|
||||
pub count: usize,
|
||||
}
|
||||
|
||||
impl<T: Serialize> IntoResponse for Array<T> {
|
||||
fn into_response(self) -> Response {
|
||||
crate::from!(self).into_response()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user