Files
altherego/src/utils.rs

26 lines
519 B
Rust

pub struct RequestID(String);
impl std::fmt::Display for RequestID {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}
#[derive(Clone)]
pub struct Generators;
impl Generators {
pub fn new() -> Self {
Self
}
pub fn next_request_id(&self) -> RequestID {
let data: u32 = rand::random();
let data_hex = format!("{:x}", data);
log::info!("issued new request: {}", data_hex);
RequestID(data_hex)
}
}