Added From<T> for BaseResponse

This commit is contained in:
Martin Berg Alstad
2024-08-14 20:37:10 +02:00
parent 347314460a
commit cd558eebfa
4 changed files with 9 additions and 3 deletions

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::*;