Skip to main content

appletheia_application/request_context/
correlation_id.rs

1use std::{fmt, fmt::Display};
2
3use serde::{Deserialize, Serialize};
4use uuid::Uuid;
5
6#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
7#[serde(transparent)]
8pub struct CorrelationId(pub Uuid);
9
10impl From<CorrelationId> for Uuid {
11    fn from(value: CorrelationId) -> Self {
12        value.0
13    }
14}
15
16impl Display for CorrelationId {
17    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18        write!(f, "{}", self.0)
19    }
20}