aboutsummaryrefslogtreecommitdiff
path: root/src/helper.rs
blob: 22ccd0dbc1bcd8c629c4bc941d475b1c125e0676 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use axum::{
    http::{HeaderValue, header},
    response::{IntoResponse, Response},
};

#[derive(Clone, Copy, Debug)]
#[must_use]
pub struct Css<T>(pub T);

impl<T> IntoResponse for Css<T>
where
    T: IntoResponse,
{
    fn into_response(self) -> Response {
        (
            [(header::CONTENT_TYPE, HeaderValue::from_static("text/css"))],
            self.0,
        )
            .into_response()
    }
}