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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
// fix up links in README
//! [LICENSE]: https://github.com/agrif/smallish/blob/main/LICENSE
//! [from_str]: from_str
//! [from_slice]: from_slice
//! [Deserializer]: de::Deserializer
//! [syntax]: syntax
//! [Flavor]: Flavor
//! [types]: types
/// Flavor decides what type of value is assumed at the root of the document.
///
/// For example, [List](Flavor::List) flavored *smallish* consists of
/// the body of a list, without the enclosing braces.
///
/// ```
/// # use smallish::{Flavor, from_str};
/// let a: Vec<u8> = from_str(Flavor::Value, "[1, 2, 3]").unwrap();
/// let b: Vec<u8> = from_str(Flavor::List, "1, 2, 3").unwrap();
/// assert_eq!(a, b);
/// ```
///
/// The main purpose of this is to allow writing lists of enumerations
/// as a plain, newline-separated list of values by using the
/// [List](Flavor::List) flavor.
// The default state size used in the convenience functions.
// This is a macro so the docs can reuse it and stay in sync.
// This might be overkill.
/// Deserialize a value from a slice of bytes.
///
/// This is a convenience function to deserialize a value with some
/// sensible defaults. In particular, this uses a fixed recursion
/// depth of
/// If you are getting a
/// [MaxRecursion](de::ParseError::MaxRecursion) error, please use
/// [Deserializer](de::Deserializer) directly.
///
/// This function will return
/// [UnescapeBufferFull](de::Error::UnescapeBufferFull) if the input
/// contains escaped strings or escaped bytes. Use
/// [from_slice_escaped] instead, or opt-out of unescaping with
/// [Escaped](types::Escaped).
///
/// For deserializing from strings, see [from_str].
/// Deserialize a value from a slice of bytes, and handle escaped strings.
///
/// This is a convenience function to deserialize a value with some
/// sensible defaults. In particular, this uses a fixed recursion
/// depth of
/// If you are getting a
/// [MaxRecursion](de::ParseError::MaxRecursion) error, please use
/// [Deserializer](de::Deserializer) directly.
///
/// This uses `unescape` as a scratch buffer to remove escapes from
/// strings and bytes. If this buffer runs out of space, this function
/// returns
/// [UnescapeBufferFull](de::Error::UnescapeBufferFull). Consider
/// using a larger buffer, or using [Escaped](types::Escaped).
///
/// For deserializing from strings, see [from_str_escaped].
/// Deserialize a value from a string.
///
/// This is a convenience function to deserialize a value with some
/// sensible defaults. In particular, this uses a fixed recursion
/// depth of
/// If you are getting a
/// [MaxRecursion](de::ParseError::MaxRecursion) error, please use
/// [Deserializer](de::Deserializer) directly.
///
/// This function will return
/// [UnescapeBufferFull](de::Error::UnescapeBufferFull) if the input
/// contains escaped strings or escaped bytes. Use [from_str_escaped]
/// instead, or opt-out of unescaping with [Escaped](types::Escaped).
///
/// For deserializing from bytes, see [from_slice].
/// Deserialize a value from a string, and handle escaped strings.
///
/// This is a convenience function to deserialize a value with some
/// sensible defaults. In particular, this uses a fixed recursion
/// depth of
/// If you are getting a
/// [MaxRecursion](de::ParseError::MaxRecursion) error, please use
/// [Deserializer](de::Deserializer) directly.
///
/// This uses `unescape` as a scratch buffer to remove escapes from
/// strings and bytes. If this buffer runs out of space, this function
/// returns
/// [UnescapeBufferFull](de::Error::UnescapeBufferFull). Consider
/// using a larger buffer, or using [Escaped](types::Escaped).
///
/// For deserializing from bytes, see [from_slice_escaped].