1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! Options controlling binary VDF parsing.
/// Strategy for handling byte sequences that are not valid UTF-8 (or UTF-16).
///
/// Steam stores string values in binary VDF files as raw byte strings and does
/// **not** guarantee they are valid UTF-8. Localized fields in particular often
/// carry legacy code-page bytes (e.g. a Czech app name `Moje Spore v\u{fffd}tvory`
/// where `0xFD` is Windows-1250 `ý`), which are not valid UTF-8 on their own.
///
/// This enum selects what the parser does when it encounters such bytes.
/// Options controlling how binary VDF data is parsed.
///
/// Construct with [`ParseOptions::new`] (or [`Default`]) and configure with the
/// builder-style methods:
///
/// ```
/// use steam_vdf_parser::{InvalidUtf8, ParseOptions};
///
/// // Default: lossy handling of invalid UTF-8.
/// let opts = ParseOptions::new();
/// assert_eq!(opts.invalid_utf8, InvalidUtf8::Lossy);
///
/// // Opt into strict error-on-invalid behavior.
/// let strict = ParseOptions::new().invalid_utf8(InvalidUtf8::Strict);
/// assert_eq!(strict.invalid_utf8, InvalidUtf8::Strict);
/// ```