Coverage Report

Created: 2026-01-09 06:11

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/combine-4.6.7/src/error.rs
Line
Count
Source
1
use crate::lib::fmt;
2
3
#[cfg(feature = "std")]
4
use std::error::Error as StdError;
5
6
use crate::{stream::StreamOnce, ErrorOffset};
7
8
use self::ParseResult::*;
9
10
pub(crate) trait ResultExt<E, T> {
11
    fn committed(self) -> ParseResult<E, T>;
12
}
13
14
impl<E, T> ResultExt<E, T> for Result<E, T> {
15
11.0M
    fn committed(self) -> ParseResult<E, T> {
16
11.0M
        match self {
17
11.0M
            Ok(x) => CommitOk(x),
18
0
            Err(x) => CommitErr(x),
19
        }
20
11.0M
    }
<core::result::Result<(), combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>> as combine::error::ResultExt<(), combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>::committed
Line
Count
Source
15
11.0M
    fn committed(self) -> ParseResult<E, T> {
16
11.0M
        match self {
17
11.0M
            Ok(x) => CommitOk(x),
18
0
            Err(x) => CommitErr(x),
19
        }
20
11.0M
    }
Unexecuted instantiation: <core::result::Result<_, _> as combine::error::ResultExt<_, _>>::committed
21
}
22
23
#[macro_export]
24
#[doc(hidden)]
25
macro_rules! ctry {
26
    ($result:expr) => {
27
        match $result {
28
            $crate::error::ParseResult::CommitOk(x) => (x, $crate::error::Commit::Commit(())),
29
            $crate::error::ParseResult::PeekOk(x) => (x, $crate::error::Commit::Peek(())),
30
            $crate::error::ParseResult::CommitErr(err) => {
31
                return $crate::error::ParseResult::CommitErr(err.into())
32
            }
33
            $crate::error::ParseResult::PeekErr(err) => {
34
                return $crate::error::ParseResult::PeekErr(err.into())
35
            }
36
        }
37
    };
38
}
39
40
/// Trait for types which can be used to construct error information.
41
///
42
/// To call functions expecting this trait, use the wrapper types defined in this module
43
/// `Token`, `Range`, `Format` or `Static`/`&'static str`
44
pub trait ErrorInfo<'s, T, R> {
45
    type Format: fmt::Display;
46
47
    #[allow(clippy::wrong_self_convention)]
48
    fn into_info(&'s self) -> Info<T, R, Self::Format>;
49
}
50
51
impl<'s, 'a, T, R, F> ErrorInfo<'s, T, R> for &'a F
52
where
53
    F: ErrorInfo<'s, T, R>,
54
{
55
    type Format = F::Format;
56
4.66k
    fn into_info(&'s self) -> Info<T, R, Self::Format> {
57
4.66k
        (**self).into_info()
58
4.66k
    }
<&combine::error::Token<u8> as combine::error::ErrorInfo<u8, &[u8]>>::into_info
Line
Count
Source
56
1.19k
    fn into_info(&'s self) -> Info<T, R, Self::Format> {
57
1.19k
        (**self).into_info()
58
1.19k
    }
<&&str as combine::error::ErrorInfo<u8, &[u8]>>::into_info
Line
Count
Source
56
3.46k
    fn into_info(&'s self) -> Info<T, R, Self::Format> {
57
3.46k
        (**self).into_info()
58
3.46k
    }
Unexecuted instantiation: <&_ as combine::error::ErrorInfo<_, _>>::into_info
59
}
60
61
#[derive(Clone, Debug)]
62
pub enum Info<T, R, F = &'static str> {
63
    Token(T),
64
    Range(R),
65
    Static(&'static str),
66
    Format(F),
67
}
68
69
impl<'s, T, R, F> ErrorInfo<'s, T, R> for Info<T, R, F>
70
where
71
    T: Clone,
72
    R: Clone,
73
    F: fmt::Display + 's,
74
{
75
    type Format = &'s F;
76
0
    fn into_info(&'s self) -> Info<T, R, <Self as ErrorInfo<'_, T, R>>::Format> {
77
0
        match self {
78
0
            Info::Token(b) => Info::Token(b.clone()),
79
0
            Info::Range(b) => Info::Range(b.clone()),
80
0
            Info::Static(b) => Info::Static(*b),
81
0
            Info::Format(b) => Info::Format(b),
82
        }
83
0
    }
84
}
85
86
impl<R, F> From<char> for Info<char, R, F> {
87
0
    fn from(s: char) -> Self {
88
0
        Info::Token(s)
89
0
    }
90
}
91
92
impl<'s, R> ErrorInfo<'s, char, R> for char {
93
    type Format = &'static str;
94
0
    fn into_info(&self) -> Info<char, R, Self::Format> {
95
0
        Info::Token(*self)
96
0
    }
97
}
98
99
impl<T, R, F> From<&'static str> for Info<T, R, F> {
100
0
    fn from(s: &'static str) -> Self {
101
0
        Info::Static(s)
102
0
    }
103
}
104
105
impl<'s, T, R> ErrorInfo<'s, T, R> for &'static str {
106
    type Format = &'static str;
107
3.46k
    fn into_info(&self) -> Info<T, R, Self::Format> {
108
3.46k
        Info::Static(*self)
109
3.46k
    }
<&str as combine::error::ErrorInfo<u8, &[u8]>>::into_info
Line
Count
Source
107
3.46k
    fn into_info(&self) -> Info<T, R, Self::Format> {
108
3.46k
        Info::Static(*self)
109
3.46k
    }
Unexecuted instantiation: <&str as combine::error::ErrorInfo<_, _>>::into_info
110
}
111
112
impl<R, F> From<u8> for Info<u8, R, F> {
113
0
    fn from(s: u8) -> Self {
114
0
        Info::Token(s)
115
0
    }
116
}
117
118
impl<R> ErrorInfo<'_, Self, R> for u8 {
119
    type Format = &'static str;
120
0
    fn into_info(&self) -> Info<Self, R, Self::Format> {
121
0
        Info::Token(*self)
122
0
    }
123
}
124
125
/// Newtype which constructs an `Info::Token` through `ErrorInfo`
126
pub struct Token<T>(pub T);
127
128
impl<T, R> From<Token<T>> for Info<T, R, &'static str> {
129
0
    fn from(s: Token<T>) -> Self {
130
0
        Info::Token(s.0)
131
0
    }
132
}
133
134
impl<'s, T, R> ErrorInfo<'s, T, R> for Token<T>
135
where
136
    T: Clone,
137
{
138
    type Format = &'static str;
139
1.67k
    fn into_info(&'s self) -> Info<T, R, Self::Format> {
140
1.67k
        Info::Token(self.0.clone())
141
1.67k
    }
<combine::error::Token<u8> as combine::error::ErrorInfo<u8, &[u8]>>::into_info
Line
Count
Source
139
1.67k
    fn into_info(&'s self) -> Info<T, R, Self::Format> {
140
1.67k
        Info::Token(self.0.clone())
141
1.67k
    }
Unexecuted instantiation: <combine::error::Token<_> as combine::error::ErrorInfo<_, _>>::into_info
142
}
143
144
/// Newtype which constructs an `Info::Range` through `ErrorInfo`
145
pub struct Range<R>(pub R);
146
147
impl<T, R> From<Range<R>> for Info<T, R, &'static str> {
148
0
    fn from(s: Range<R>) -> Self {
149
0
        Info::Range(s.0)
150
0
    }
151
}
152
153
impl<'s, T, R> ErrorInfo<'s, T, R> for Range<R>
154
where
155
    R: Clone,
156
{
157
    type Format = &'static str;
158
0
    fn into_info(&'s self) -> Info<T, R, Self::Format> {
159
0
        Info::Range(self.0.clone())
160
0
    }
161
}
162
163
/// Newtype which constructs an `Info::Static` through `ErrorInfo`
164
/// A plain `&'static str` can also be used, this exists for consistency.
165
pub struct Static(&'static str);
166
167
impl<T, R, F> From<Static> for Info<T, R, F>
168
where
169
    F: fmt::Display,
170
{
171
0
    fn from(s: Static) -> Self {
172
0
        Info::Static(s.0)
173
0
    }
174
}
175
176
impl<'s, T, R> ErrorInfo<'s, T, R> for Static {
177
    type Format = &'static str;
178
0
    fn into_info(&'s self) -> Info<T, R, Self::Format> {
179
0
        Info::Static(self.0)
180
0
    }
181
}
182
183
/// Newtype which constructs an `Info::Format` through `ErrorInfo`
184
pub struct Format<F>(pub F)
185
where
186
    F: fmt::Display;
187
188
impl<T, R, F> From<Format<F>> for Info<T, R, F>
189
where
190
    F: fmt::Display,
191
{
192
0
    fn from(s: Format<F>) -> Self {
193
0
        Info::Format(s.0)
194
0
    }
195
}
196
197
impl<'s, T, R, F> ErrorInfo<'s, T, R> for Format<F>
198
where
199
    F: fmt::Display + 's,
200
{
201
    type Format = &'s F;
202
0
    fn into_info(&'s self) -> Info<T, R, Self::Format> {
203
0
        Info::Format(&self.0)
204
0
    }
205
}
206
207
/// Enum used to indicate if a parser committed any items of the stream it was given as an input.
208
///
209
/// This is used by parsers such as `or` and `choice` to determine if they should try to parse
210
/// with another parser as they will only be able to provide good error reporting if the preceding
211
/// parser did not commit to the parse.
212
#[derive(Clone, PartialEq, Debug, Copy)]
213
pub enum Commit<T> {
214
    /// Constructor indicating that the parser has committed to this parse. If a parser after this fails,
215
    /// other parser alternatives will not be attempted (`CommitErr` will be returned)
216
    Commit(T),
217
    /// Constructor indicating that the parser has not committed to this parse. If a parser after this fails,
218
    /// other parser alternatives will be attempted (`EmptyErr` will be returned)
219
    Peek(T),
220
}
221
222
impl<T> AsMut<T> for Commit<T> {
223
0
    fn as_mut(&mut self) -> &mut T {
224
0
        match *self {
225
0
            Commit::Peek(ref mut t) | Commit::Commit(ref mut t) => t,
226
        }
227
0
    }
228
}
229
230
impl<T> AsRef<T> for Commit<T> {
231
0
    fn as_ref(&self) -> &T {
232
0
        match *self {
233
0
            Commit::Peek(ref t) | Commit::Commit(ref t) => t,
234
        }
235
0
    }
236
}
237
238
impl<T> Commit<T> {
239
    /// Returns true if `self` is peek.
240
0
    pub fn is_peek(&self) -> bool {
241
0
        match *self {
242
0
            Commit::Peek(_) => true,
243
0
            Commit::Commit(_) => false,
244
        }
245
0
    }
246
247
    /// Extracts the contained value.
248
163k
    pub fn into_inner(self) -> T {
249
163k
        match self {
250
163k
            Commit::Peek(x) | Commit::Commit(x) => x,
251
        }
252
163k
    }
<combine::error::Commit<combine::error::Tracked<combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>>::into_inner
Line
Count
Source
248
163k
    pub fn into_inner(self) -> T {
249
163k
        match self {
250
163k
            Commit::Peek(x) | Commit::Commit(x) => x,
251
        }
252
163k
    }
Unexecuted instantiation: <combine::error::Commit<_>>::into_inner
253
254
    /// Converts `self` into the `Commit` state.
255
0
    pub fn into_commit(self) -> Commit<T> {
256
0
        Commit::Commit(self.into_inner())
257
0
    }
258
259
    /// Converts `self` into the `Peek` state.
260
0
    pub fn into_peek(self) -> Commit<T> {
261
0
        Commit::Peek(self.into_inner())
262
0
    }
263
264
    /// Maps over the contained value without changing the committed state.
265
0
    pub fn map<F, U>(self, f: F) -> Commit<U>
266
0
    where
267
0
        F: FnOnce(T) -> U,
268
    {
269
0
        match self {
270
0
            Commit::Peek(x) => Commit::Peek(f(x)),
271
0
            Commit::Commit(x) => Commit::Commit(f(x)),
272
        }
273
0
    }
274
275
0
    pub fn merge(&self, current: Commit<T>) -> Commit<T> {
276
0
        match *self {
277
0
            Commit::Peek(_) => current,
278
0
            Commit::Commit(_) => current.into_commit(),
279
        }
280
0
    }
281
282
    /// Combines the `Commit` flags from `self` and the result of `f`.
283
    ///
284
    /// ```text
285
    /// Peek    <> Peek    -> Peek
286
    /// Commit <> Peek    -> Commit
287
    /// Peek    <> Commit -> Commit
288
    /// Commit <> Commit -> Commit
289
    /// ```
290
    ///
291
    /// ```
292
    /// # extern crate combine as pc;
293
    /// # use pc::*;
294
    /// # fn main() {
295
    /// //Parses a character of string literal and handles the escaped characters \\ and \" as \
296
    /// //and " respectively
297
    /// fn char<Input>(input: &mut Input) -> StdParseResult<char, Input>
298
    ///     where Input: Stream<Token = char>,
299
    /// {
300
    ///     let (c, committed) = satisfy(|c| c != '"').parse_stream(input).into_result()?;
301
    ///     match c {
302
    ///         //Since the `char` parser has already committed some of the input `combine` is used
303
    ///         //propagate the committed state to the next part of the parser
304
    ///         '\\' => committed.combine(|_| {
305
    ///             satisfy(|c| c == '"' || c == '\\')
306
    ///                 .map(|c| {
307
    ///                     match c {
308
    ///                         '"' => '"',
309
    ///                         '\\' => '\\',
310
    ///                         c => c
311
    ///                     }
312
    ///                 })
313
    ///                 .parse_stream(input)
314
    ///                 .into_result()
315
    ///             }),
316
    ///         _ => Ok((c, committed))
317
    ///     }
318
    /// }
319
    /// let result = many(parser(char))
320
    ///     .easy_parse(r#"abc\"\\"#);
321
    /// assert_eq!(result, Ok((r#"abc"\"#.to_string(), "")));
322
    /// }
323
    /// ```
324
0
    pub fn combine<F, U, E>(self, f: F) -> StdParseResult2<U, E>
325
0
    where
326
0
        F: FnOnce(T) -> StdParseResult2<U, E>,
327
    {
328
0
        match self {
329
0
            Commit::Commit(x) => match f(x) {
330
0
                Ok((v, Commit::Peek(()))) => Ok((v, Commit::Commit(()))),
331
0
                Err(Commit::Peek(err)) => Err(Commit::Commit(err)),
332
0
                y => y,
333
            },
334
0
            Commit::Peek(x) => f(x),
335
        }
336
0
    }
337
0
    pub fn combine_commit<F, U, E>(self, f: F) -> ParseResult<U, E>
338
0
    where
339
0
        F: FnOnce(T) -> ParseResult<U, E>,
340
    {
341
        use self::ParseResult::*;
342
343
0
        match self {
344
0
            Commit::Commit(x) => match f(x) {
345
0
                PeekOk(v) => CommitOk(v),
346
0
                PeekErr(err) => CommitErr(err.error),
347
0
                y => y,
348
            },
349
0
            Commit::Peek(x) => f(x),
350
        }
351
0
    }
352
}
353
354
/// A type alias over the specific `Result` type used by parsers to indicate whether they were
355
/// successful or not.
356
/// `O` is the type that is output on success.
357
/// `Input` is the specific stream type used in the parser.
358
pub type StdParseResult<O, Input> =
359
    Result<(O, Commit<()>), Commit<Tracked<<Input as StreamOnce>::Error>>>;
360
pub type StdParseResult2<O, E> = Result<(O, Commit<()>), Commit<Tracked<E>>>;
361
362
/// `StreamError` represents a single error returned from a `Stream` or a `Parser`.
363
///
364
/// Usually multiple instances of `StreamError` is composed into a `ParseError` to build the final
365
/// error value.
366
pub trait StreamError<Item, Range>: Sized {
367
    fn unexpected_token(token: Item) -> Self;
368
    fn unexpected_range(token: Range) -> Self;
369
    fn unexpected_format<T>(msg: T) -> Self
370
    where
371
        T: fmt::Display;
372
4.64k
    fn unexpected<E>(info: E) -> Self
373
4.64k
    where
374
4.64k
        E: for<'s> ErrorInfo<'s, Item, Range>,
375
    {
376
4.64k
        match info.into_info() {
377
1.67k
            Info::Token(b) => Self::unexpected_token(b),
378
0
            Info::Range(b) => Self::unexpected_range(b),
379
2.96k
            Info::Static(b) => Self::unexpected_static_message(b),
380
0
            Info::Format(b) => Self::unexpected_format(b),
381
        }
382
4.64k
    }
<combine::stream::easy::Error<u8, &[u8]> as combine::error::StreamError<u8, &[u8]>>::unexpected::<combine::error::Token<u8>>
Line
Count
Source
372
482
    fn unexpected<E>(info: E) -> Self
373
482
    where
374
482
        E: for<'s> ErrorInfo<'s, Item, Range>,
375
    {
376
482
        match info.into_info() {
377
482
            Info::Token(b) => Self::unexpected_token(b),
378
0
            Info::Range(b) => Self::unexpected_range(b),
379
0
            Info::Static(b) => Self::unexpected_static_message(b),
380
0
            Info::Format(b) => Self::unexpected_format(b),
381
        }
382
482
    }
<combine::stream::easy::Error<u8, &[u8]> as combine::error::StreamError<u8, &[u8]>>::unexpected::<&combine::error::Token<u8>>
Line
Count
Source
372
1.19k
    fn unexpected<E>(info: E) -> Self
373
1.19k
    where
374
1.19k
        E: for<'s> ErrorInfo<'s, Item, Range>,
375
    {
376
1.19k
        match info.into_info() {
377
1.19k
            Info::Token(b) => Self::unexpected_token(b),
378
0
            Info::Range(b) => Self::unexpected_range(b),
379
0
            Info::Static(b) => Self::unexpected_static_message(b),
380
0
            Info::Format(b) => Self::unexpected_format(b),
381
        }
382
1.19k
    }
<combine::stream::easy::Error<u8, &[u8]> as combine::error::StreamError<u8, &[u8]>>::unexpected::<&&str>
Line
Count
Source
372
2.96k
    fn unexpected<E>(info: E) -> Self
373
2.96k
    where
374
2.96k
        E: for<'s> ErrorInfo<'s, Item, Range>,
375
    {
376
2.96k
        match info.into_info() {
377
0
            Info::Token(b) => Self::unexpected_token(b),
378
0
            Info::Range(b) => Self::unexpected_range(b),
379
2.96k
            Info::Static(b) => Self::unexpected_static_message(b),
380
0
            Info::Format(b) => Self::unexpected_format(b),
381
        }
382
2.96k
    }
Unexecuted instantiation: <_ as combine::error::StreamError<_, _>>::unexpected::<_>
383
0
    fn unexpected_static_message(msg: &'static str) -> Self {
384
0
        Self::unexpected_format(msg)
385
0
    }
386
387
    fn expected_token(token: Item) -> Self;
388
    fn expected_range(token: Range) -> Self;
389
    fn expected_format<T>(msg: T) -> Self
390
    where
391
        T: fmt::Display;
392
503
    fn expected<E>(info: E) -> Self
393
503
    where
394
503
        E: for<'s> ErrorInfo<'s, Item, Range>,
395
    {
396
503
        match info.into_info() {
397
0
            Info::Token(b) => Self::expected_token(b),
398
0
            Info::Range(b) => Self::expected_range(b),
399
503
            Info::Static(b) => Self::expected_static_message(b),
400
0
            Info::Format(b) => Self::expected_format(b),
401
        }
402
503
    }
<combine::stream::easy::Error<u8, &[u8]> as combine::error::StreamError<u8, &[u8]>>::expected::<&&str>
Line
Count
Source
392
503
    fn expected<E>(info: E) -> Self
393
503
    where
394
503
        E: for<'s> ErrorInfo<'s, Item, Range>,
395
    {
396
503
        match info.into_info() {
397
0
            Info::Token(b) => Self::expected_token(b),
398
0
            Info::Range(b) => Self::expected_range(b),
399
503
            Info::Static(b) => Self::expected_static_message(b),
400
0
            Info::Format(b) => Self::expected_format(b),
401
        }
402
503
    }
Unexecuted instantiation: <_ as combine::error::StreamError<_, _>>::expected::<_>
403
0
    fn expected_static_message(msg: &'static str) -> Self {
404
0
        Self::expected_format(msg)
405
0
    }
406
407
    fn message_token(token: Item) -> Self;
408
    fn message_range(token: Range) -> Self;
409
    fn message_format<T>(msg: T) -> Self
410
    where
411
        T: fmt::Display;
412
0
    fn message_static_message(msg: &'static str) -> Self {
413
0
        Self::message_format(msg)
414
0
    }
415
0
    fn message<E>(info: E) -> Self
416
0
    where
417
0
        E: for<'s> ErrorInfo<'s, Item, Range>,
418
    {
419
0
        match info.into_info() {
420
0
            Info::Token(b) => Self::message_token(b),
421
0
            Info::Range(b) => Self::message_range(b),
422
0
            Info::Static(b) => Self::message_static_message(b),
423
0
            Info::Format(b) => Self::message_format(b),
424
        }
425
0
    }
426
427
    #[cfg(feature = "std")]
428
0
    fn other<E>(err: E) -> Self
429
0
    where
430
0
        E: StdError + Send + Sync + 'static,
431
    {
432
0
        Self::message_format(err)
433
0
    }
434
435
172k
    fn end_of_input() -> Self {
436
172k
        Self::unexpected_static_message("end of input")
437
172k
    }
<combine::stream::easy::Error<u8, &[u8]> as combine::error::StreamError<u8, &[u8]>>::end_of_input
Line
Count
Source
435
172k
    fn end_of_input() -> Self {
436
172k
        Self::unexpected_static_message("end of input")
437
172k
    }
Unexecuted instantiation: <_ as combine::error::StreamError<_, _>>::end_of_input
438
439
    fn is_unexpected_end_of_input(&self) -> bool;
440
441
    /// Converts `self` into a different `StreamError` type.
442
    ///
443
    /// This should aim to preserve as much information as possible into the returned `T` value but
444
    /// if `Self` ignores some information passed to it using one of the constructors that
445
    /// information is naturally lost.
446
    fn into_other<T>(self) -> T
447
    where
448
        T: StreamError<Item, Range>;
449
}
450
451
/// Trait which defines a combine parse error.
452
///
453
/// A parse error is composed of zero or more `StreamError` instances which gets added to it as
454
/// errors are encountered during parsing.
455
pub trait ParseError<Item, Range, Position>: Sized + PartialEq {
456
    type StreamError: StreamError<Item, Range>;
457
458
    /// Constructs an empty error.
459
    ///
460
    /// An empty error is expected to be cheap to create as it is frequently created and discarded.
461
    fn empty(position: Position) -> Self;
462
463
    /// Creates a `ParseError` from a single `Self::StreamError`
464
0
    fn from_error(position: Position, err: Self::StreamError) -> Self {
465
0
        let mut errors = Self::empty(position);
466
0
        errors.add(err);
467
0
        errors
468
0
    }
469
470
0
    fn position(&self) -> Position {
471
        // TODO Remove the default implementation in a breaking release
472
0
        unimplemented!()
473
    }
474
475
    /// Sets the position of this `ParseError`
476
    fn set_position(&mut self, position: Position);
477
478
    /// Merges two errors. If they exist at the same position the errors of `other` are
479
    /// added to `self` (using the semantics of `add`). If they are not at the same
480
    /// position the error furthest ahead are returned, ignoring the other `ParseError`.
481
0
    fn merge(self, other: Self) -> Self {
482
0
        other
483
0
    }
484
485
    /// Adds a `StreamError` to `self`.
486
    ///
487
    /// It is up to each individual error type to define what adding an error does, some may push
488
    /// it to a vector while others may only keep `self` or `err` to avoid allocation
489
    fn add(&mut self, err: Self::StreamError);
490
491
0
    fn add_expected<E>(&mut self, info: E)
492
0
    where
493
0
        E: for<'s> ErrorInfo<'s, Item, Range>,
494
    {
495
0
        self.add(Self::StreamError::expected(info))
496
0
    }
497
498
482
    fn add_unexpected<E>(&mut self, info: E)
499
482
    where
500
482
        E: for<'s> ErrorInfo<'s, Item, Range>,
501
    {
502
482
        self.add(Self::StreamError::unexpected(info))
503
482
    }
<combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>> as combine::error::ParseError<u8, &[u8], combine::stream::PointerOffset<[u8]>>>::add_unexpected::<combine::error::Token<u8>>
Line
Count
Source
498
482
    fn add_unexpected<E>(&mut self, info: E)
499
482
    where
500
482
        E: for<'s> ErrorInfo<'s, Item, Range>,
501
    {
502
482
        self.add(Self::StreamError::unexpected(info))
503
482
    }
Unexecuted instantiation: <_ as combine::error::ParseError<_, _, _>>::add_unexpected::<_>
504
505
0
    fn add_message<E>(&mut self, info: E)
506
0
    where
507
0
        E: for<'s> ErrorInfo<'s, Item, Range>,
508
    {
509
0
        self.add(Self::StreamError::message(info))
510
0
    }
511
512
    /// Sets `info` as the *only* `Expected` error of `self`
513
    fn set_expected<F>(self_: &mut Tracked<Self>, info: Self::StreamError, f: F)
514
    where
515
        F: FnOnce(&mut Tracked<Self>);
516
517
    /// Removes any expected errors currently in `self`
518
0
    fn clear_expected(&mut self) {}
519
520
    fn is_unexpected_end_of_input(&self) -> bool;
521
522
    /// Does a best-effort conversion of `self` into another `ParseError`
523
    fn into_other<T>(self) -> T
524
    where
525
        T: ParseError<Item, Range, Position>;
526
}
527
528
/// Defines a conversion between two parse error types.
529
///
530
/// Like `ParseError::into_other` but with a more general signature
531
/// (This will take the place of `into_other` on breaking release of combine)
532
pub trait ParseErrorInto<Item, Range, Position>: Sized {
533
    fn into_other_error<T, Item2, Range2, Position2>(self) -> T
534
    where
535
        T: ParseError<Item2, Range2, Position2>,
536
        Item2: From<Item>,
537
        Range2: From<Range>,
538
        Position2: From<Position>;
539
}
540
541
/// Defines a conversion between two stream error types.
542
///
543
/// Like `StreamError::into_other` but with a more general signature
544
/// (This will take the place of `into_other` on breaking release of combine)
545
pub trait StreamErrorInto<Item, Range>: Sized {
546
    fn into_other_error<T, Item2, Range2>(self) -> T
547
    where
548
        T: StreamError<Item2, Range2>,
549
        Item2: From<Item>,
550
        Range2: From<Range>;
551
}
552
553
#[derive(Clone, Copy, Debug, PartialEq)]
554
pub enum UnexpectedParse {
555
    Eoi,
556
    Unexpected,
557
}
558
559
impl fmt::Display for UnexpectedParse {
560
0
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
561
0
        write!(f, "{}", self.as_str())
562
0
    }
563
}
564
565
#[cfg(feature = "std")]
566
impl StdError for UnexpectedParse {
567
0
    fn description(&self) -> &str {
568
0
        self.as_str()
569
0
    }
570
}
571
572
impl UnexpectedParse {
573
0
    fn as_str(&self) -> &str {
574
        use self::UnexpectedParse::*;
575
0
        match *self {
576
0
            Unexpected => "unexpected parse",
577
0
            Eoi => "unexpected end of input",
578
        }
579
0
    }
580
}
581
582
impl<Item, Range> StreamError<Item, Range> for UnexpectedParse {
583
    #[inline]
584
0
    fn unexpected_token(_: Item) -> Self {
585
0
        UnexpectedParse::Unexpected
586
0
    }
587
    #[inline]
588
0
    fn unexpected_range(_: Range) -> Self {
589
0
        UnexpectedParse::Unexpected
590
0
    }
591
    #[inline]
592
0
    fn unexpected_format<T>(_: T) -> Self
593
0
    where
594
0
        T: fmt::Display,
595
    {
596
0
        UnexpectedParse::Unexpected
597
0
    }
598
599
    #[inline]
600
0
    fn expected_token(_: Item) -> Self {
601
0
        UnexpectedParse::Unexpected
602
0
    }
603
    #[inline]
604
0
    fn expected_range(_: Range) -> Self {
605
0
        UnexpectedParse::Unexpected
606
0
    }
607
    #[inline]
608
0
    fn expected_format<T>(_: T) -> Self
609
0
    where
610
0
        T: fmt::Display,
611
    {
612
0
        UnexpectedParse::Unexpected
613
0
    }
614
    #[inline]
615
0
    fn message_format<T>(_: T) -> Self
616
0
    where
617
0
        T: fmt::Display,
618
    {
619
0
        UnexpectedParse::Unexpected
620
0
    }
621
    #[inline]
622
0
    fn message_token(_: Item) -> Self {
623
0
        UnexpectedParse::Unexpected
624
0
    }
625
    #[inline]
626
0
    fn message_range(_: Range) -> Self {
627
0
        UnexpectedParse::Unexpected
628
0
    }
629
630
    #[inline]
631
0
    fn end_of_input() -> Self {
632
0
        UnexpectedParse::Eoi
633
0
    }
634
635
    #[inline]
636
0
    fn is_unexpected_end_of_input(&self) -> bool {
637
0
        *self == UnexpectedParse::Eoi
638
0
    }
639
640
    #[inline]
641
74.3k
    fn into_other<T>(self) -> T
642
74.3k
    where
643
74.3k
        T: StreamError<Item, Range>,
644
    {
645
74.3k
        match self {
646
0
            UnexpectedParse::Unexpected => T::unexpected_static_message("parse"),
647
74.3k
            UnexpectedParse::Eoi => T::end_of_input(),
648
        }
649
74.3k
    }
<combine::error::UnexpectedParse as combine::error::StreamError<u8, &[u8]>>::into_other::<combine::stream::easy::Error<u8, &[u8]>>
Line
Count
Source
641
74.3k
    fn into_other<T>(self) -> T
642
74.3k
    where
643
74.3k
        T: StreamError<Item, Range>,
644
    {
645
74.3k
        match self {
646
0
            UnexpectedParse::Unexpected => T::unexpected_static_message("parse"),
647
74.3k
            UnexpectedParse::Eoi => T::end_of_input(),
648
        }
649
74.3k
    }
Unexecuted instantiation: <combine::error::UnexpectedParse as combine::error::StreamError<_, _>>::into_other::<_>
650
}
651
652
impl<Item, Range, Position> ParseError<Item, Range, Position> for UnexpectedParse
653
where
654
    Position: Default,
655
{
656
    type StreamError = Self;
657
    #[inline]
658
0
    fn empty(_position: Position) -> Self {
659
0
        UnexpectedParse::Unexpected
660
0
    }
661
662
    #[inline]
663
0
    fn from_error(_: Position, err: Self::StreamError) -> Self {
664
0
        err
665
0
    }
666
667
0
    fn position(&self) -> Position {
668
0
        Position::default()
669
0
    }
670
671
    #[inline]
672
0
    fn set_position(&mut self, _position: Position) {}
673
674
    #[inline]
675
0
    fn add(&mut self, err: Self::StreamError) {
676
0
        *self = match (*self, err) {
677
0
            (UnexpectedParse::Eoi, _) => UnexpectedParse::Eoi,
678
0
            (_, err) => err,
679
        };
680
0
    }
681
682
    #[inline]
683
0
    fn set_expected<F>(self_: &mut Tracked<Self>, info: Self::StreamError, f: F)
684
0
    where
685
0
        F: FnOnce(&mut Tracked<Self>),
686
    {
687
0
        f(self_);
688
0
        self_.error = info;
689
0
    }
690
691
0
    fn is_unexpected_end_of_input(&self) -> bool {
692
0
        *self == UnexpectedParse::Eoi
693
0
    }
694
695
    #[inline]
696
0
    fn into_other<T>(self) -> T
697
0
    where
698
0
        T: ParseError<Item, Range, Position>,
699
    {
700
0
        T::from_error(Position::default(), StreamError::into_other(self))
701
0
    }
Unexecuted instantiation: <combine::error::UnexpectedParse as combine::error::ParseError<u8, &[u8], combine::stream::PointerOffset<[u8]>>>::into_other::<combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>
Unexecuted instantiation: <combine::error::UnexpectedParse as combine::error::ParseError<_, _, _>>::into_other::<_>
702
}
703
704
impl<Item, Range, Position> ParseErrorInto<Item, Range, Position> for UnexpectedParse
705
where
706
    Position: Default,
707
{
708
0
    fn into_other_error<T, Item2, Range2, Position2>(self) -> T
709
0
    where
710
0
        T: ParseError<Item2, Range2, Position2>,
711
0
        Item2: From<Item>,
712
0
        Range2: From<Range>,
713
0
        Position2: From<Position>,
714
    {
715
0
        T::from_error(
716
0
            Position::default().into(),
717
0
            StreamErrorInto::<Item, Range>::into_other_error(self),
718
        )
719
0
    }
720
}
721
722
impl<Item, Range> StreamErrorInto<Item, Range> for UnexpectedParse {
723
0
    fn into_other_error<T, Item2, Range2>(self) -> T
724
0
    where
725
0
        T: StreamError<Item2, Range2>,
726
0
        Item2: From<Item>,
727
0
        Range2: From<Range>,
728
    {
729
0
        StreamError::into_other(self)
730
0
    }
731
}
732
733
#[derive(Clone, Copy, Debug, PartialEq)]
734
pub enum StringStreamError {
735
    UnexpectedParse,
736
    Eoi,
737
    CharacterBoundary,
738
}
739
740
pub(crate) const CHAR_BOUNDARY_ERROR_MESSAGE: &str = "unexpected slice on character boundary";
741
742
impl fmt::Display for StringStreamError {
743
0
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
744
0
        write!(f, "{}", self.as_str())
745
0
    }
746
}
747
748
#[cfg(feature = "std")]
749
impl StdError for StringStreamError {
750
0
    fn description(&self) -> &str {
751
0
        self.as_str()
752
0
    }
753
}
754
755
impl StringStreamError {
756
0
    fn as_str(&self) -> &str {
757
        use self::StringStreamError::*;
758
0
        match *self {
759
0
            UnexpectedParse => "unexpected parse",
760
0
            Eoi => "unexpected end of input",
761
0
            CharacterBoundary => CHAR_BOUNDARY_ERROR_MESSAGE,
762
        }
763
0
    }
764
}
765
766
impl<Item, Range> StreamError<Item, Range> for StringStreamError {
767
    #[inline]
768
0
    fn unexpected_token(_: Item) -> Self {
769
0
        StringStreamError::UnexpectedParse
770
0
    }
771
    #[inline]
772
0
    fn unexpected_range(_: Range) -> Self {
773
0
        StringStreamError::UnexpectedParse
774
0
    }
775
    #[inline]
776
0
    fn unexpected_format<T>(_msg: T) -> Self
777
0
    where
778
0
        T: fmt::Display,
779
    {
780
0
        StringStreamError::UnexpectedParse
781
0
    }
782
783
    #[inline]
784
0
    fn expected_token(_: Item) -> Self {
785
0
        StringStreamError::UnexpectedParse
786
0
    }
787
    #[inline]
788
0
    fn expected_range(_: Range) -> Self {
789
0
        StringStreamError::UnexpectedParse
790
0
    }
791
    #[inline]
792
0
    fn expected_format<T>(_: T) -> Self
793
0
    where
794
0
        T: fmt::Display,
795
    {
796
0
        StringStreamError::UnexpectedParse
797
0
    }
798
    #[inline]
799
0
    fn message_format<T>(_: T) -> Self
800
0
    where
801
0
        T: fmt::Display,
802
    {
803
0
        StringStreamError::UnexpectedParse
804
0
    }
805
    #[inline]
806
0
    fn message_token(_: Item) -> Self {
807
0
        StringStreamError::UnexpectedParse
808
0
    }
809
    #[inline]
810
0
    fn message_range(_: Range) -> Self {
811
0
        StringStreamError::UnexpectedParse
812
0
    }
813
0
    fn message_static_message(msg: &'static str) -> Self {
814
0
        if msg == CHAR_BOUNDARY_ERROR_MESSAGE {
815
0
            StringStreamError::CharacterBoundary
816
        } else {
817
0
            StringStreamError::UnexpectedParse
818
        }
819
0
    }
820
    #[inline]
821
0
    fn end_of_input() -> Self {
822
0
        StringStreamError::Eoi
823
0
    }
824
    #[inline]
825
0
    fn is_unexpected_end_of_input(&self) -> bool {
826
0
        *self == StringStreamError::Eoi
827
0
    }
828
    #[inline]
829
0
    fn into_other<T>(self) -> T
830
0
    where
831
0
        T: StreamError<Item, Range>,
832
    {
833
0
        let msg = match self {
834
0
            StringStreamError::CharacterBoundary => CHAR_BOUNDARY_ERROR_MESSAGE,
835
0
            StringStreamError::UnexpectedParse => "parse",
836
0
            StringStreamError::Eoi => return T::end_of_input(),
837
        };
838
0
        T::unexpected_static_message(msg)
839
0
    }
840
}
841
impl<Item, Range, Position> ParseError<Item, Range, Position> for StringStreamError
842
where
843
    Position: Default,
844
{
845
    type StreamError = Self;
846
    #[inline]
847
0
    fn empty(_position: Position) -> Self {
848
0
        StringStreamError::UnexpectedParse
849
0
    }
850
    #[inline]
851
0
    fn from_error(_: Position, err: Self::StreamError) -> Self {
852
0
        err
853
0
    }
854
855
0
    fn position(&self) -> Position {
856
0
        Position::default()
857
0
    }
858
859
    #[inline]
860
0
    fn set_position(&mut self, _position: Position) {}
861
862
    #[inline]
863
0
    fn add(&mut self, err: Self::StreamError) {
864
0
        *self = match (*self, err) {
865
0
            (StringStreamError::Eoi, _) => StringStreamError::Eoi,
866
0
            (_, err) => err,
867
        };
868
0
    }
869
870
    #[inline]
871
0
    fn set_expected<F>(self_: &mut Tracked<Self>, info: Self::StreamError, f: F)
872
0
    where
873
0
        F: FnOnce(&mut Tracked<Self>),
874
    {
875
0
        f(self_);
876
0
        self_.error = info;
877
0
    }
878
879
0
    fn is_unexpected_end_of_input(&self) -> bool {
880
0
        *self == StringStreamError::Eoi
881
0
    }
882
883
    #[inline]
884
0
    fn into_other<T>(self) -> T
885
0
    where
886
0
        T: ParseError<Item, Range, Position>,
887
    {
888
0
        T::from_error(Position::default(), StreamError::into_other(self))
889
0
    }
890
}
891
892
impl<Item, Range, Position> ParseErrorInto<Item, Range, Position> for StringStreamError
893
where
894
    Position: Default,
895
{
896
0
    fn into_other_error<T, Item2, Range2, Position2>(self) -> T
897
0
    where
898
0
        T: ParseError<Item2, Range2, Position2>,
899
0
        Item2: From<Item>,
900
0
        Range2: From<Range>,
901
0
        Position2: From<Position>,
902
    {
903
0
        T::from_error(
904
0
            Position::default().into(),
905
0
            StreamErrorInto::<Item, Range>::into_other_error(self),
906
        )
907
0
    }
908
}
909
910
impl<Item, Range> StreamErrorInto<Item, Range> for StringStreamError {
911
0
    fn into_other_error<T, Item2, Range2>(self) -> T
912
0
    where
913
0
        T: StreamError<Item2, Range2>,
914
0
        Item2: From<Item>,
915
0
        Range2: From<Range>,
916
    {
917
0
        StreamError::into_other(self)
918
0
    }
919
}
920
921
/// Error wrapper which lets parsers track which parser in a sequence of sub-parsers has emitted
922
/// the error. `Tracked::from` can be used to construct this and it should otherwise be
923
/// ignored outside of combine.
924
#[derive(Clone, PartialEq, Debug, Copy)]
925
pub struct Tracked<E> {
926
    /// The error returned
927
    pub error: E,
928
    #[doc(hidden)]
929
    pub offset: ErrorOffset,
930
}
931
932
impl<E> From<E> for Tracked<E> {
933
173k
    fn from(error: E) -> Self {
934
173k
        Tracked {
935
173k
            error,
936
173k
            offset: ErrorOffset(1),
937
173k
        }
938
173k
    }
<combine::error::Tracked<combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>> as core::convert::From<combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>::from
Line
Count
Source
933
173k
    fn from(error: E) -> Self {
934
173k
        Tracked {
935
173k
            error,
936
173k
            offset: ErrorOffset(1),
937
173k
        }
938
173k
    }
Unexecuted instantiation: <combine::error::Tracked<_> as core::convert::From<_>>::from
939
}
940
941
/// A `Result` type which has the committed status flattened into the result.
942
/// Conversions to and from `std::result::Result` can be done using `result.into()` or
943
/// `From::from(result)`
944
#[derive(Clone, PartialEq, Debug, Copy)]
945
pub enum ParseResult<T, E> {
946
    /// The parser has succeeded and has committed to this parse. If a parser after this fails,
947
    /// other parser alternatives will not be attempted (`CommitErr` will be returned)
948
    CommitOk(T),
949
    /// The parser has succeeded and has not committed to this parse. If a parser after this fails,
950
    /// other parser alternatives will be attempted (`PeekErr` will be returned)
951
    PeekOk(T),
952
    /// The parser failed other parse alternatives will not be attempted.
953
    CommitErr(E),
954
    /// The parser failed but other parse alternatives may be attempted.
955
    PeekErr(Tracked<E>),
956
}
957
958
impl<T, E> ParseResult<T, E> {
959
    #[inline]
960
5.41M
    pub fn is_ok(&self) -> bool {
961
5.41M
        match *self {
962
5.41M
            CommitOk(_) | PeekOk(_) => true,
963
0
            CommitErr(_) | PeekErr(_) => false,
964
        }
965
5.41M
    }
<combine::error::ParseResult<&[u8], combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>::is_ok
Line
Count
Source
960
5.41M
    pub fn is_ok(&self) -> bool {
961
5.41M
        match *self {
962
5.41M
            CommitOk(_) | PeekOk(_) => true,
963
0
            CommitErr(_) | PeekErr(_) => false,
964
        }
965
5.41M
    }
Unexecuted instantiation: <combine::error::ParseResult<_, _>>::is_ok
966
967
    #[inline]
968
0
    pub fn is_err(&self) -> bool {
969
0
        !self.is_ok()
970
0
    }
971
972
0
    pub fn as_ref(&self) -> ParseResult<&T, &E> {
973
0
        match *self {
974
0
            CommitOk(ref t) => CommitOk(t),
975
0
            PeekOk(ref t) => PeekOk(t),
976
0
            CommitErr(ref e) => CommitErr(e),
977
0
            PeekErr(ref e) => PeekErr(Tracked {
978
0
                error: &e.error,
979
0
                offset: e.offset,
980
0
            }),
981
        }
982
0
    }
983
984
0
    pub fn and_then<F, T2>(self, f: F) -> F::Output
985
0
    where
986
0
        F: FnOnce(T) -> ParseResult<T2, E>,
987
    {
988
0
        match self {
989
0
            CommitOk(t) => match f(t) {
990
0
                CommitOk(t2) | PeekOk(t2) => CommitOk(t2),
991
0
                PeekErr(e) => CommitErr(e.error),
992
0
                CommitErr(e) => CommitErr(e),
993
            },
994
0
            PeekOk(t) => f(t),
995
0
            CommitErr(e) => CommitErr(e),
996
0
            PeekErr(e) => PeekErr(e),
997
        }
998
0
    }
999
1000
0
    pub fn map_err<F, E2>(self, f: F) -> ParseResult<T, F::Output>
1001
0
    where
1002
0
        F: FnOnce(E) -> E2,
1003
    {
1004
0
        match self {
1005
0
            CommitOk(t) => CommitOk(t),
1006
0
            PeekOk(t) => PeekOk(t),
1007
0
            CommitErr(e) => CommitErr(f(e)),
1008
0
            PeekErr(e) => PeekErr(Tracked {
1009
0
                error: f(e.error),
1010
0
                offset: e.offset,
1011
0
            }),
1012
        }
1013
0
    }
1014
1015
17.1M
    pub fn map<F, T2>(self, f: F) -> ParseResult<F::Output, E>
1016
17.1M
    where
1017
17.1M
        F: FnOnce(T) -> T2,
1018
    {
1019
17.1M
        match self {
1020
12.7M
            CommitOk(t) => CommitOk(f(t)),
1021
4.22M
            PeekOk(t) => PeekOk(f(t)),
1022
200k
            CommitErr(e) => CommitErr(e),
1023
3.54k
            PeekErr(e) => PeekErr(e),
1024
        }
1025
17.1M
    }
<combine::error::ParseResult<alloc::vec::Vec<redis::types::Value>, combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>::map::<<combine::parser::repeat::CountMinMax<alloc::vec::Vec<redis::types::Value>, combine::parser::combinator::Opaque<redis::parser::value<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}, combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>, redis::types::Value, combine::parser::combinator::AnySendSyncPartialState>> as combine::parser::Parser<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>>::parse_mode_impl<combine::parser::PartialMode>::{closure#1}, alloc::vec::Vec<redis::types::Value>>
Line
Count
Source
1015
16.9k
    pub fn map<F, T2>(self, f: F) -> ParseResult<F::Output, E>
1016
16.9k
    where
1017
16.9k
        F: FnOnce(T) -> T2,
1018
    {
1019
16.9k
        match self {
1020
16.9k
            CommitOk(t) => CommitOk(f(t)),
1021
0
            PeekOk(t) => PeekOk(f(t)),
1022
0
            CommitErr(e) => CommitErr(e),
1023
0
            PeekErr(e) => PeekErr(e),
1024
        }
1025
16.9k
    }
<combine::error::ParseResult<alloc::vec::Vec<redis::types::Value>, combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>::map::<<combine::parser::repeat::CountMinMax<alloc::vec::Vec<redis::types::Value>, combine::parser::combinator::Opaque<redis::parser::value<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}, combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>, redis::types::Value, combine::parser::combinator::AnySendSyncPartialState>> as combine::parser::Parser<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>>::parse_mode_impl<combine::parser::FirstMode>::{closure#1}, alloc::vec::Vec<redis::types::Value>>
Line
Count
Source
1015
117k
    pub fn map<F, T2>(self, f: F) -> ParseResult<F::Output, E>
1016
117k
    where
1017
117k
        F: FnOnce(T) -> T2,
1018
    {
1019
117k
        match self {
1020
101k
            CommitOk(t) => CommitOk(f(t)),
1021
16.4k
            PeekOk(t) => PeekOk(f(t)),
1022
0
            CommitErr(e) => CommitErr(e),
1023
0
            PeekErr(e) => PeekErr(e),
1024
        }
1025
117k
    }
<combine::error::ParseResult<&[u8], combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>::map::<<combine::parser::combinator::Ignore<combine::parser::byte::take_until_bytes<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>> as combine::parser::Parser<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>>::parse_mode_impl<combine::parser::PartialMode>::{closure#0}, ()>
Line
Count
Source
1015
92.5k
    pub fn map<F, T2>(self, f: F) -> ParseResult<F::Output, E>
1016
92.5k
    where
1017
92.5k
        F: FnOnce(T) -> T2,
1018
    {
1019
92.5k
        match self {
1020
24.4k
            CommitOk(t) => CommitOk(f(t)),
1021
47.2k
            PeekOk(t) => PeekOk(f(t)),
1022
19.9k
            CommitErr(e) => CommitErr(e),
1023
827
            PeekErr(e) => PeekErr(e),
1024
        }
1025
92.5k
    }
<combine::error::ParseResult<&[u8], combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>::map::<<combine::parser::combinator::Ignore<combine::parser::byte::take_until_bytes<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>> as combine::parser::Parser<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>>::parse_mode_impl<combine::parser::FirstMode>::{closure#0}, ()>
Line
Count
Source
1015
5.41M
    pub fn map<F, T2>(self, f: F) -> ParseResult<F::Output, E>
1016
5.41M
    where
1017
5.41M
        F: FnOnce(T) -> T2,
1018
    {
1019
5.41M
        match self {
1020
1.17M
            CommitOk(t) => CommitOk(f(t)),
1021
4.16M
            PeekOk(t) => PeekOk(f(t)),
1022
70.6k
            CommitErr(e) => CommitErr(e),
1023
0
            PeekErr(e) => PeekErr(e),
1024
        }
1025
5.41M
    }
<combine::error::ParseResult<&[u8], combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>::map::<<combine::parser::range::RecognizeWithValue<&mut combine::parser::sequence::With<combine::parser::byte::take_until_bytes<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>, combine::parser::combinator::Map<combine::parser::range::Take<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>, redis::parser::value<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}::{closure#1}::{closure#0}::{closure#0}>>> as combine::parser::Parser<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>>::parse_mode<combine::parser::PartialMode>::{closure#0}, (&[u8], ())>
Line
Count
Source
1015
71.7k
    pub fn map<F, T2>(self, f: F) -> ParseResult<F::Output, E>
1016
71.7k
    where
1017
71.7k
        F: FnOnce(T) -> T2,
1018
    {
1019
71.7k
        match self {
1020
71.7k
            CommitOk(t) => CommitOk(f(t)),
1021
0
            PeekOk(t) => PeekOk(f(t)),
1022
0
            CommitErr(e) => CommitErr(e),
1023
0
            PeekErr(e) => PeekErr(e),
1024
        }
1025
71.7k
    }
<combine::error::ParseResult<&[u8], combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>::map::<<combine::parser::range::RecognizeWithValue<&mut combine::parser::sequence::With<combine::parser::byte::take_until_bytes<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>, combine::parser::combinator::Map<combine::parser::range::Take<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>, redis::parser::value<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}::{closure#1}::{closure#0}::{closure#0}>>> as combine::parser::Parser<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>>::parse_mode<combine::parser::FirstMode>::{closure#0}, (&[u8], ())>
Line
Count
Source
1015
5.34M
    pub fn map<F, T2>(self, f: F) -> ParseResult<F::Output, E>
1016
5.34M
    where
1017
5.34M
        F: FnOnce(T) -> T2,
1018
    {
1019
5.34M
        match self {
1020
5.34M
            CommitOk(t) => CommitOk(f(t)),
1021
0
            PeekOk(t) => PeekOk(f(t)),
1022
0
            CommitErr(e) => CommitErr(e),
1023
0
            PeekErr(e) => PeekErr(e),
1024
        }
1025
5.34M
    }
<combine::error::ParseResult<(alloc::string::String, ()), combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>::map::<<combine::parser::sequence::Skip<combine::parser::combinator::Map<combine::parser::range::Take<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>, redis::parser::value<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}::{closure#1}::{closure#4}::{closure#0}::{closure#0}>, combine::parser::error::Expected<combine::parser::combinator::NoPartial<combine::parser::sequence::With<combine::parser::token::Satisfy<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>, combine::parser::byte::crlf<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}>, combine::parser::error::Expected<combine::parser::token::Satisfy<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>, combine::parser::byte::newline<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}>, &str>>>, &str>> as combine::parser::Parser<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>>::parse_mode_impl<combine::parser::PartialMode>::{closure#0}, alloc::string::String>
Line
Count
Source
1015
7.72k
    pub fn map<F, T2>(self, f: F) -> ParseResult<F::Output, E>
1016
7.72k
    where
1017
7.72k
        F: FnOnce(T) -> T2,
1018
    {
1019
7.72k
        match self {
1020
3.20k
            CommitOk(t) => CommitOk(f(t)),
1021
0
            PeekOk(t) => PeekOk(f(t)),
1022
4.22k
            CommitErr(e) => CommitErr(e),
1023
298
            PeekErr(e) => PeekErr(e),
1024
        }
1025
7.72k
    }
<combine::error::ParseResult<(alloc::string::String, ()), combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>::map::<<combine::parser::sequence::Skip<combine::parser::combinator::Map<combine::parser::range::Take<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>, redis::parser::value<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}::{closure#1}::{closure#4}::{closure#0}::{closure#0}>, combine::parser::error::Expected<combine::parser::combinator::NoPartial<combine::parser::sequence::With<combine::parser::token::Satisfy<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>, combine::parser::byte::crlf<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}>, combine::parser::error::Expected<combine::parser::token::Satisfy<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>, combine::parser::byte::newline<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}>, &str>>>, &str>> as combine::parser::Parser<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>>::parse_mode_impl<combine::parser::FirstMode>::{closure#0}, alloc::string::String>
Line
Count
Source
1015
111k
    pub fn map<F, T2>(self, f: F) -> ParseResult<F::Output, E>
1016
111k
    where
1017
111k
        F: FnOnce(T) -> T2,
1018
    {
1019
111k
        match self {
1020
107k
            CommitOk(t) => CommitOk(f(t)),
1021
0
            PeekOk(t) => PeekOk(f(t)),
1022
3.61k
            CommitErr(e) => CommitErr(e),
1023
31
            PeekErr(e) => PeekErr(e),
1024
        }
1025
111k
    }
<combine::error::ParseResult<(redis::types::Value, ()), combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>::map::<<combine::parser::sequence::Skip<combine::parser::combinator::Map<combine::parser::range::Take<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>, redis::parser::value<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}::{closure#1}::{closure#3}::{closure#0}::{closure#1}>, combine::parser::error::Expected<combine::parser::combinator::NoPartial<combine::parser::sequence::With<combine::parser::token::Satisfy<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>, combine::parser::byte::crlf<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}>, combine::parser::error::Expected<combine::parser::token::Satisfy<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>, combine::parser::byte::newline<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}>, &str>>>, &str>> as combine::parser::Parser<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>>::parse_mode_impl<combine::parser::PartialMode>::{closure#0}, redis::types::Value>
Line
Count
Source
1015
3.26k
    pub fn map<F, T2>(self, f: F) -> ParseResult<F::Output, E>
1016
3.26k
    where
1017
3.26k
        F: FnOnce(T) -> T2,
1018
    {
1019
3.26k
        match self {
1020
1.67k
            CommitOk(t) => CommitOk(f(t)),
1021
0
            PeekOk(t) => PeekOk(f(t)),
1022
1.27k
            CommitErr(e) => CommitErr(e),
1023
319
            PeekErr(e) => PeekErr(e),
1024
        }
1025
3.26k
    }
<combine::error::ParseResult<(redis::types::Value, ()), combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>::map::<<combine::parser::sequence::Skip<combine::parser::combinator::Map<combine::parser::range::Take<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>, redis::parser::value<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}::{closure#1}::{closure#3}::{closure#0}::{closure#1}>, combine::parser::error::Expected<combine::parser::combinator::NoPartial<combine::parser::sequence::With<combine::parser::token::Satisfy<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>, combine::parser::byte::crlf<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}>, combine::parser::error::Expected<combine::parser::token::Satisfy<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>, combine::parser::byte::newline<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}>, &str>>>, &str>> as combine::parser::Parser<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>>::parse_mode_impl<combine::parser::FirstMode>::{closure#0}, redis::types::Value>
Line
Count
Source
1015
28.3k
    pub fn map<F, T2>(self, f: F) -> ParseResult<F::Output, E>
1016
28.3k
    where
1017
28.3k
        F: FnOnce(T) -> T2,
1018
    {
1019
28.3k
        match self {
1020
26.2k
            CommitOk(t) => CommitOk(f(t)),
1021
0
            PeekOk(t) => PeekOk(f(t)),
1022
2.10k
            CommitErr(e) => CommitErr(e),
1023
34
            PeekErr(e) => PeekErr(e),
1024
        }
1025
28.3k
    }
<combine::error::ParseResult<((), u8), combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>::map::<<combine::parser::sequence::With<combine::parser::token::Satisfy<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>, combine::parser::byte::crlf<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}>, combine::parser::error::Expected<combine::parser::token::Satisfy<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>, combine::parser::byte::newline<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}>, &str>> as combine::parser::Parser<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>>::parse_lazy::{closure#0}, u8>
Line
Count
Source
1015
141k
    pub fn map<F, T2>(self, f: F) -> ParseResult<F::Output, E>
1016
141k
    where
1017
141k
        F: FnOnce(T) -> T2,
1018
    {
1019
141k
        match self {
1020
138k
            CommitOk(t) => CommitOk(f(t)),
1021
0
            PeekOk(t) => PeekOk(f(t)),
1022
2.98k
            CommitErr(e) => CommitErr(e),
1023
404
            PeekErr(e) => PeekErr(e),
1024
        }
1025
141k
    }
<combine::error::ParseResult<((), ()), combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>::map::<<combine::parser::sequence::With<combine::parser::byte::take_until_bytes<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>, combine::parser::combinator::Map<combine::parser::range::Take<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>, redis::parser::value<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}::{closure#1}::{closure#0}::{closure#0}>> as combine::parser::Parser<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>>::parse_mode_impl<combine::parser::PartialMode>::{closure#0}, ()>
Line
Count
Source
1015
92.5k
    pub fn map<F, T2>(self, f: F) -> ParseResult<F::Output, E>
1016
92.5k
    where
1017
92.5k
        F: FnOnce(T) -> T2,
1018
    {
1019
92.5k
        match self {
1020
71.7k
            CommitOk(t) => CommitOk(f(t)),
1021
0
            PeekOk(t) => PeekOk(f(t)),
1022
19.9k
            CommitErr(e) => CommitErr(e),
1023
827
            PeekErr(e) => PeekErr(e),
1024
        }
1025
92.5k
    }
<combine::error::ParseResult<((), ()), combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>::map::<<combine::parser::sequence::With<combine::parser::byte::take_until_bytes<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>, combine::parser::combinator::Map<combine::parser::range::Take<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>, redis::parser::value<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}::{closure#1}::{closure#0}::{closure#0}>> as combine::parser::Parser<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>>::parse_mode_impl<combine::parser::FirstMode>::{closure#0}, ()>
Line
Count
Source
1015
5.41M
    pub fn map<F, T2>(self, f: F) -> ParseResult<F::Output, E>
1016
5.41M
    where
1017
5.41M
        F: FnOnce(T) -> T2,
1018
    {
1019
5.41M
        match self {
1020
5.34M
            CommitOk(t) => CommitOk(f(t)),
1021
0
            PeekOk(t) => PeekOk(f(t)),
1022
70.6k
            CommitErr(e) => CommitErr(e),
1023
0
            PeekErr(e) => PeekErr(e),
1024
        }
1025
5.41M
    }
<combine::error::ParseResult<u8, combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>::map::<<combine::parser::combinator::Ignore<combine::parser::error::Expected<combine::parser::combinator::NoPartial<combine::parser::sequence::With<combine::parser::token::Satisfy<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>, combine::parser::byte::crlf<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}>, combine::parser::error::Expected<combine::parser::token::Satisfy<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>, combine::parser::byte::newline<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}>, &str>>>, &str>> as combine::parser::Parser<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>>::parse_mode_impl<combine::parser::PartialMode>::{closure#0}, ()>
Line
Count
Source
1015
2.88k
    pub fn map<F, T2>(self, f: F) -> ParseResult<F::Output, E>
1016
2.88k
    where
1017
2.88k
        F: FnOnce(T) -> T2,
1018
    {
1019
2.88k
        match self {
1020
2.54k
            CommitOk(t) => CommitOk(f(t)),
1021
0
            PeekOk(t) => PeekOk(f(t)),
1022
124
            CommitErr(e) => CommitErr(e),
1023
214
            PeekErr(e) => PeekErr(e),
1024
        }
1025
2.88k
    }
<combine::error::ParseResult<u8, combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>::map::<<combine::parser::combinator::Ignore<combine::parser::error::Expected<combine::parser::combinator::NoPartial<combine::parser::sequence::With<combine::parser::token::Satisfy<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>, combine::parser::byte::crlf<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}>, combine::parser::error::Expected<combine::parser::token::Satisfy<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>, combine::parser::byte::newline<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}>, &str>>>, &str>> as combine::parser::Parser<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>>::parse_mode_impl<combine::parser::FirstMode>::{closure#0}, ()>
Line
Count
Source
1015
139k
    pub fn map<F, T2>(self, f: F) -> ParseResult<F::Output, E>
1016
139k
    where
1017
139k
        F: FnOnce(T) -> T2,
1018
    {
1019
139k
        match self {
1020
136k
            CommitOk(t) => CommitOk(f(t)),
1021
0
            PeekOk(t) => PeekOk(f(t)),
1022
2.85k
            CommitErr(e) => CommitErr(e),
1023
190
            PeekErr(e) => PeekErr(e),
1024
        }
1025
139k
    }
<combine::error::ParseResult<u8, combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>::map::<<combine::parser::combinator::Ignore<combine::parser::token::Satisfy<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>, combine::parser::byte::crlf<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>::{closure#0}>> as combine::parser::Parser<combine::stream::easy::Stream<combine::stream::MaybePartialStream<&[u8]>>>>::parse_mode_impl<combine::parser::FirstMode>::{closure#0}, ()>
Line
Count
Source
1015
141k
    pub fn map<F, T2>(self, f: F) -> ParseResult<F::Output, E>
1016
141k
    where
1017
141k
        F: FnOnce(T) -> T2,
1018
    {
1019
141k
        match self {
1020
139k
            CommitOk(t) => CommitOk(f(t)),
1021
0
            PeekOk(t) => PeekOk(f(t)),
1022
2.28k
            CommitErr(e) => CommitErr(e),
1023
404
            PeekErr(e) => PeekErr(e),
1024
        }
1025
141k
    }
Unexecuted instantiation: <combine::error::ParseResult<_, _>>::map::<_, _>
1026
}
1027
1028
impl<O, E> ParseResult<O, E> {
1029
0
    pub fn into_result(self) -> StdParseResult2<O, E> {
1030
0
        self.into()
1031
0
    }
1032
}
1033
1034
impl<T, E> Into<Result<Commit<T>, Commit<Tracked<E>>>> for ParseResult<T, E> {
1035
    #[inline]
1036
0
    fn into(self) -> Result<Commit<T>, Commit<Tracked<E>>> {
1037
0
        match self {
1038
0
            CommitOk(t) => Ok(Commit::Commit(t)),
1039
0
            PeekOk(t) => Ok(Commit::Peek(t)),
1040
0
            CommitErr(e) => Err(Commit::Commit(e.into())),
1041
0
            PeekErr(e) => Err(Commit::Peek(e)),
1042
        }
1043
0
    }
1044
}
1045
1046
impl<O, E> Into<StdParseResult2<O, E>> for ParseResult<O, E> {
1047
    #[inline]
1048
165k
    fn into(self) -> StdParseResult2<O, E> {
1049
        use self::ParseResult::*;
1050
1051
165k
        match self {
1052
2.16k
            CommitOk(t) => Ok((t, Commit::Commit(()))),
1053
0
            PeekOk(t) => Ok((t, Commit::Peek(()))),
1054
163k
            CommitErr(e) => Err(Commit::Commit(e.into())),
1055
25
            PeekErr(e) => Err(Commit::Peek(e)),
1056
        }
1057
165k
    }
<combine::error::ParseResult<redis::types::Value, combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>> as core::convert::Into<core::result::Result<(redis::types::Value, combine::error::Commit<()>), combine::error::Commit<combine::error::Tracked<combine::stream::easy::Errors<u8, &[u8], combine::stream::PointerOffset<[u8]>>>>>>>::into
Line
Count
Source
1048
165k
    fn into(self) -> StdParseResult2<O, E> {
1049
        use self::ParseResult::*;
1050
1051
165k
        match self {
1052
2.16k
            CommitOk(t) => Ok((t, Commit::Commit(()))),
1053
0
            PeekOk(t) => Ok((t, Commit::Peek(()))),
1054
163k
            CommitErr(e) => Err(Commit::Commit(e.into())),
1055
25
            PeekErr(e) => Err(Commit::Peek(e)),
1056
        }
1057
165k
    }
Unexecuted instantiation: <combine::error::ParseResult<_, _> as core::convert::Into<core::result::Result<(_, combine::error::Commit<()>), combine::error::Commit<combine::error::Tracked<_>>>>>::into
1058
}
1059
1060
impl<O, E> From<StdParseResult2<O, E>> for ParseResult<O, E> {
1061
    #[inline]
1062
0
    fn from(result: StdParseResult2<O, E>) -> ParseResult<O, E> {
1063
        use self::ParseResult::*;
1064
1065
0
        match result {
1066
0
            Ok((t, Commit::Commit(()))) => CommitOk(t),
1067
0
            Ok((t, Commit::Peek(()))) => PeekOk(t),
1068
0
            Err(Commit::Commit(e)) => CommitErr(e.error),
1069
0
            Err(Commit::Peek(e)) => PeekErr(e),
1070
        }
1071
0
    }
1072
}
1073
1074
#[cfg(all(feature = "std", test))]
1075
mod tests_std {
1076
1077
    use crate::Parser;
1078
1079
    #[derive(Clone, PartialEq, Debug)]
1080
    struct CloneOnly {
1081
        s: String,
1082
    }
1083
1084
    #[test]
1085
    fn parse_clone_but_not_copy() {
1086
        // This verifies we can parse slice references with an token type that is Clone but not Copy.
1087
        let input = &[
1088
            CloneOnly { s: "x".to_string() },
1089
            CloneOnly { s: "y".to_string() },
1090
        ][..];
1091
        let result = crate::parser::range::take_while(|c: CloneOnly| c.s == "x").parse(input);
1092
        assert_eq!(
1093
            result,
1094
            Ok((
1095
                &[CloneOnly { s: "x".to_string() }][..],
1096
                &[CloneOnly { s: "y".to_string() }][..]
1097
            ))
1098
        );
1099
    }
1100
}