codeberg_cli/render/option.rs
1pub fn option_display<T: ToString>(opt: &Option<T>) -> String {
2 opt.as_ref()
3 .map(|t| t.to_string())
4 .unwrap_or_else(|| String::from("?"))
5}
6
7pub fn option_debug_display<T: std::fmt::Debug>(opt: &Option<T>) -> String {
8 opt.as_ref()
9 .map(|t| format!("{t:?}"))
10 .unwrap_or_else(|| String::from("?"))
11}