#[non_exhaustive]pub enum ParseErrorKind {
UnexpectedEof,
UnexpectedToken {
expected: &'static str,
},
InvalidNumber,
InvalidString(&'static str),
InvalidUtf8,
UnknownField,
UnknownEnumValue,
RecursionLimitExceeded,
ElementMemoryLimitExceeded,
DelimiterMismatch,
Internal(&'static str),
}text only.Expand description
The category of textproto parse error.
Variants are all zero-allocation: they hold &'static str or small Copy
payloads. The full diagnostic (including position) lives in ParseError.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnexpectedEof
Input ended while a value was still being parsed.
UnexpectedToken
A token appeared where the grammar didn’t permit it.
The expected string describes what the parser wanted — e.g.
"field name", "scalar value", "',' or ']'".
InvalidNumber
A number literal couldn’t be interpreted as the target numeric type (out of range, wrong base, or float where integer expected).
InvalidString(&'static str)
A string literal contained a malformed escape sequence.
Holds the reason produced by the unescaper — e.g.
"invalid \\x escape", "invalid unicode escape".
InvalidUtf8
A string field’s unescaped bytes were not valid UTF-8.
bytes fields use TextDecoder::read_bytes
and do not produce this error.
UnknownField
A field name appeared that the message’s merge_text does not
recognise, and the caller did not ask to skip unknowns.
UnknownEnumValue
An enum variant name was not recognised, or a closed enum received a numeric value outside its defined set.
Open (proto3) enums accept any in-range integer and never produce this error for numeric input. Closed (proto2) enums reject unknown numbers.
RecursionLimitExceeded
Message nesting exceeded RECURSION_LIMIT.
ElementMemoryLimitExceeded
The parse would materialize more repeated/map elements than the configured element-memory budget allows.
The textproto equivalent of
DecodeError::ElementMemoryLimitExceeded:
and needed for the same reason: an empty repeated message element
costs three input bytes ({},) and size_of::<Element>() in the
Vec it lands in — very nearly the wire format’s own ratio, which is
two bytes for the same footprint — so a payload well inside any
input-size cap can still expand by two orders of magnitude. Raise it
with
TextDecoder::with_element_memory_limit.
DelimiterMismatch
A message was opened with { but closed with >, or vice versa.
Textproto allows either {...} or <...> around sub-messages, but
the pair must match.
Internal(&'static str)
An internal invariant was violated during parsing.
This indicates a bug in buffa, not a problem with the input. Please report it if encountered.
Trait Implementations§
Source§impl Clone for ParseErrorKind
impl Clone for ParseErrorKind
Source§impl Debug for ParseErrorKind
impl Debug for ParseErrorKind
Source§impl Display for ParseErrorKind
impl Display for ParseErrorKind
impl Eq for ParseErrorKind
Source§impl Error for ParseErrorKind
impl Error for ParseErrorKind
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()