deser_json/trailing.rs
1//! What may follow a value.
2
3/// Controls what may follow a value.
4///
5/// See [`DeserializerConfig::trailing`](crate::DeserializerConfig::trailing).
6#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
7pub enum Trailing {
8 /// Only whitespace may follow the value.
9 ///
10 /// This is the default. Anything else after the value is an error.
11 #[default]
12 Strict,
13 /// Every value is on a line of its own ([JSON
14 /// Lines](https://jsonlines.org/), also known as NDJSON).
15 ///
16 /// Only whitespace may follow a value on its line, the next line holds
17 /// the next value. Lines that only contain whitespace are skipped.
18 /// Errors are contained to their line: if a line fails to deserialize
19 /// (even if it's malformed) the next call to
20 /// [`Deserializer::deserialize`](crate::Deserializer::deserialize) continues with the next line.
21 Newline,
22 /// Parsing stops after the value, regardless of what follows.
23 ///
24 /// The data after the value is not looked at. The next call to
25 /// [`Deserializer::deserialize`](crate::Deserializer::deserialize) continues after the value (see
26 /// [`Deserializer::offset`](crate::Deserializer::offset)), which also reads concatenated JSON.
27 Stop,
28}