cronback_lib/types/request.rs
1use derive_more::{Display, From, Into};
2use ulid::Ulid;
3
4/// A debug key is a random string that is used to identify a request.
5#[derive(
6 Debug, Clone, Default, Eq, PartialEq, PartialOrd, Ord, Display, From, Into,
7)]
8pub struct RequestId(String);
9
10impl RequestId {
11 // generate random debug key
12 pub fn new() -> Self {
13 let key = Ulid::new().to_string();
14 Self(key)
15 }
16
17 pub fn from(value: String) -> Self {
18 Self(value)
19 }
20}