1use std::convert::Infallible;
16use std::fmt;
17use std::fmt::{Display, Formatter};
18
19#[cfg(feature = "base-model")]
20pub mod base_model;
21
22#[cfg(feature = "tokio")]
23pub mod cache;
24
25#[cfg(feature = "protobuf")]
26pub mod client;
27
28#[cfg(feature = "config")]
29pub mod config;
30
31pub mod golem_version;
32
33#[cfg(feature = "protobuf")]
34pub mod grpc;
35
36#[cfg(feature = "poem")]
37pub mod json_yaml;
38
39#[cfg(feature = "observability")]
40pub mod metrics;
41
42#[cfg(feature = "model")]
43pub mod model;
44
45#[cfg(any(feature = "model", feature = "base-model"))]
46pub mod newtype;
47
48#[cfg(feature = "redis")]
49pub mod redis;
50
51#[cfg(feature = "sql")]
52pub mod repo;
53
54#[cfg(feature = "tokio")]
55pub mod retriable_error;
56
57#[cfg(feature = "tokio")]
58pub mod retries;
59
60#[cfg(feature = "serialization")]
61pub mod serialization;
62
63#[cfg(feature = "observability")]
64pub mod tracing;
65
66#[cfg(feature = "model")]
67pub mod virtual_exports;
68
69#[cfg(test)]
70test_r::enable!();
71
72pub trait SafeDisplay {
74 fn to_safe_string(&self) -> String;
75}
76
77pub struct SafeString(String);
78
79impl SafeDisplay for SafeString {
80 fn to_safe_string(&self) -> String {
81 self.0.clone()
82 }
83}
84
85impl Display for SafeString {
86 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
87 write!(f, "{}", self.0)
88 }
89}
90
91pub fn safe(value: String) -> impl SafeDisplay {
92 SafeString(value)
93}
94
95pub fn widen_infallible<T>(_inf: Infallible) -> T {
96 panic!("impossible")
97}