Skip to main content

str_truncated

Function str_truncated 

Source
pub fn str_truncated(s: &str, max_len: usize) -> DebugValue<TruncatedStr<'_>>
Expand description

Creates a tracing debug value that truncates a string.

The returned value can be recorded directly in a structured tracing field. Truncation uses a byte threshold and ends at the first following UTF-8 boundary. Formatting panics if the threshold lies within the final multibyte scalar.