Convert to a string if it has utf8 encoding, otherwise print bytes directly
(val: Option<&ByteArray>)
| 302 | |
| 303 | /// Convert to a string if it has utf8 encoding, otherwise print bytes directly |
| 304 | fn byte_array_to_string(val: Option<&ByteArray>) -> Option<String> { |
| 305 | val.map(|v| { |
| 306 | v.as_utf8() |
| 307 | .map(|s| s.to_string()) |
| 308 | .unwrap_or_else(|_e| v.to_string()) |
| 309 | }) |
| 310 | } |
| 311 | |
| 312 | /// Convert to a string if it has utf8 encoding, otherwise print bytes directly |
| 313 | fn fixed_len_byte_array_to_string(val: Option<&FixedLenByteArray>) -> Option<String> { |
no test coverage detected
searching dependent graphs…