mz_repr::adt::char

Function format_char_str

Source
fn format_char_str(
    s: &str,
    length: Option<CharLength>,
    fail_on_len: bool,
    white_space: CharWhiteSpace,
) -> Result<String, Error>
Expand description

Returns s as a String with options to enforce char and varchar semantics.

§Arguments

  • s - The str to format
  • length - An optional maximum length for the string
  • fail_on_len - Return an error if s’s character count exceeds the specified maximum length.
  • white_space - Express how to handle trailing whitespace on s

This function should only fail when fail_on_len is true and length is present and exceeded.