pub fn format_str_trim(
s: &str,
length: Option<CharLength>,
fail_on_len: bool,
) -> Result<String, Error>
Expand description
Ensures that s
has fewer than length
characters, and returns a String
version of it with all whitespace trimmed from the end.
The value returned is appropriate to store in Datum::String
, but is not
appropriate to return to clients.
This function should only fail when fail_on_len
is true
and length
is present and exceeded.