Convert a Value to a display string. - Strings: returned as-is (no quotes) - Null: empty string - Numbers/Bools: `.to_string()` - Objects/Arrays: JSON serialization
(v: &Value)
| 82 | /// - Numbers/Bools: `.to_string()` |
| 83 | /// - Objects/Arrays: JSON serialization |
| 84 | pub fn value_to_display_string(v: &Value) -> String { |
| 85 | match v { |
| 86 | Value::String(s) => s.clone(), |
| 87 | Value::Null => String::new(), |
| 88 | Value::Integer(i) => i.to_string(), |
| 89 | Value::Float(f) => f.to_string(), |
| 90 | Value::Bool(b) => b.to_string(), |
| 91 | Value::Uuid(s) | Value::Ulid(s) | Value::Regex(s) => s.clone(), |
| 92 | Value::DateTime(dt) | Value::NaiveDateTime(dt) => dt.to_iso8601(), |
| 93 | Value::Duration(d) => d.to_human(), |
| 94 | Value::Decimal(d) => d.to_string(), |
| 95 | other => { |
| 96 | // Fallback: convert to JSON string representation. |
| 97 | let json = serde_json::Value::from(other.clone()); |
| 98 | json.to_string() |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | /// Convert an f64 to a Value, preferring integer representation. |
| 104 | /// |
no test coverage detected