structured_fields/errors

Types

Errors that can occur while parsing a Structured Fields header value.

Every variant that carries a position reports the byte offset inside the input string at which the problem was detected, which is useful for constructing diagnostic messages.

pub type ParseError {
  CommaExpectedError(current_position: Int)
  InvalidBoolean(current_position: Int)
  InvalidByteSequence(current_position: Int)
  InvalidDisplayString(current_position: Int)
  InvalidParameterKey(current_position: Int)
  InvalidStringInput(current_position: Int)
  NonAsciiInput
  TrailingCommaError(current_position: Int)
  UnclosedInnerList(current_position: Int)
  UnrecognizedItemType(current_position: Int)
  WrongDateFormat(current_position: Int)
  WrongDecimalOrIntegerInput(current_position: Int)
}

Constructors

  • CommaExpectedError(current_position: Int)

    A comma was expected between two list or dictionary members but was not found. The position points to the unexpected character.

  • InvalidBoolean(current_position: Int)

    The character following ? was neither 0 nor 1.

  • InvalidByteSequence(current_position: Int)

    The content between the two : delimiters is not valid base64, or the closing : is missing.

  • InvalidDisplayString(current_position: Int)

    The display string (%"...") is malformed: a percent-escape is incomplete, an escaped byte is outside the printable ASCII range, or the closing " is missing.

  • InvalidParameterKey(current_position: Int)

    A dictionary key or parameter name is absent or starts with a character that is not a lowercase letter or *.

  • InvalidStringInput(current_position: Int)

    A quoted string contains a character outside the printable ASCII range (0x20–0x7E), an invalid escape sequence, or the closing " is missing.

  • NonAsciiInput

    The input contains at least one byte with a code point above 127 (i.e. non-ASCII). Structured Fields headers must be 7-bit ASCII.

  • TrailingCommaError(current_position: Int)

    A comma was found after the last list or dictionary member with no following member.

  • UnclosedInnerList(current_position: Int)

    An inner list opened with ( was never closed with ).

  • UnrecognizedItemType(current_position: Int)

    The first character of a bare item did not match any of the known item-type prefixes.

  • WrongDateFormat(current_position: Int)

    A date value (prefixed @) contained a decimal point; dates must be integers.

  • WrongDecimalOrIntegerInput(current_position: Int)

    A number could not be parsed as a valid integer or decimal, for example because it has more than 15 significant digits, more than three fractional digits, or ends with a decimal point.

Search Document