1use std::convert::Infallible;
8
9use axum::response::{IntoResponseParts, ResponseParts};
10use sentry::types::Uuid;
11
12#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
14pub struct SentryEventID(Uuid);
15
16impl From<Uuid> for SentryEventID {
17    fn from(uuid: Uuid) -> Self {
18        Self(uuid)
19    }
20}
21
22impl IntoResponseParts for SentryEventID {
23    type Error = Infallible;
24    fn into_response_parts(self, mut res: ResponseParts) -> Result<ResponseParts, Self::Error> {
25        res.headers_mut()
26            .insert("X-Sentry-Event-ID", self.0.to_string().parse().unwrap());
27
28        Ok(res)
29    }
30}