@@ -258,38 +258,26 @@ pub struct Data<'a> {
258
258
pub mod decode {
259
259
#[ cfg( feature = "verbose-object-parsing-errors" ) ]
260
260
mod _decode {
261
- use crate :: bstr:: { BString , ByteSlice } ;
262
-
263
261
/// The type to be used for parse errors.
264
- pub type ParseError < ' a > = winnow:: error:: VerboseError < & ' a [ u8 ] , winnow:: error:: StrContext > ;
265
- /// The owned type to be used for parse errors.
266
- pub type ParseErrorOwned = winnow:: error:: VerboseError < BString , winnow:: error:: StrContext > ;
262
+ pub type ParseError = winnow:: error:: ContextError < winnow:: error:: StrContext > ;
267
263
268
264
pub ( crate ) fn empty_error ( ) -> Error {
269
265
Error {
270
- inner : winnow:: error:: VerboseError :: < _ , _ > { errors : Vec :: new ( ) } ,
266
+ inner : winnow:: error:: ContextError :: new ( ) ,
271
267
}
272
268
}
273
269
274
270
/// A type to indicate errors during parsing and to abstract away details related to `nom`.
275
271
#[ derive( Debug , Clone ) ]
276
272
pub struct Error {
277
273
/// The actual error
278
- pub inner : ParseErrorOwned ,
274
+ pub inner : ParseError ,
279
275
}
280
276
281
- impl < ' a > From < winnow:: error:: ErrMode < ParseError < ' a > > > for Error {
282
- fn from ( v : winnow:: error:: ErrMode < ParseError < ' a > > ) -> Self {
277
+ impl From < winnow:: error:: ErrMode < ParseError > > for Error {
278
+ fn from ( v : winnow:: error:: ErrMode < ParseError > ) -> Self {
283
279
let err = v. into_inner ( ) . expect ( "we don't have streaming parsers" ) ;
284
- Error {
285
- inner : winnow:: error:: VerboseError {
286
- errors : err
287
- . errors
288
- . into_iter ( )
289
- . map ( |( i, v) | ( i. as_bstr ( ) . to_owned ( ) , v) )
290
- . collect ( ) ,
291
- } ,
292
- }
280
+ Error { inner : err }
293
281
}
294
282
}
295
283
@@ -304,9 +292,7 @@ pub mod decode {
304
292
#[ cfg( not( feature = "verbose-object-parsing-errors" ) ) ]
305
293
mod _decode {
306
294
/// The type to be used for parse errors, discards everything and is zero size
307
- pub type ParseError < ' a > = ( ) ;
308
- /// The owned type to be used for parse errors, discards everything and is zero size
309
- pub type ParseErrorOwned = ( ) ;
295
+ pub type ParseError = ( ) ;
310
296
311
297
pub ( crate ) fn empty_error ( ) -> Error {
312
298
Error { inner : ( ) }
@@ -316,11 +302,11 @@ pub mod decode {
316
302
#[ derive( Debug , Clone ) ]
317
303
pub struct Error {
318
304
/// The actual error
319
- pub inner : ParseErrorOwned ,
305
+ pub inner : ParseError ,
320
306
}
321
307
322
- impl < ' a > From < winnow:: error:: ErrMode < ParseError < ' a > > > for Error {
323
- fn from ( v : winnow:: error:: ErrMode < ParseError < ' a > > ) -> Self {
308
+ impl From < winnow:: error:: ErrMode < ParseError > > for Error {
309
+ fn from ( v : winnow:: error:: ErrMode < ParseError > ) -> Self {
324
310
let err = v. into_inner ( ) . expect ( "we don't have streaming parsers" ) ;
325
311
Error { inner : err }
326
312
}
@@ -333,7 +319,7 @@ pub mod decode {
333
319
}
334
320
}
335
321
pub ( crate ) use _decode:: empty_error;
336
- pub use _decode:: { Error , ParseError , ParseErrorOwned } ;
322
+ pub use _decode:: { Error , ParseError } ;
337
323
impl std:: error:: Error for Error { }
338
324
339
325
/// Returned by [`loose_header()`]
0 commit comments