@@ -10,7 +10,7 @@ use crate::flatten::FlattenParser;
1010use crate :: many:: { ManyCombiner , ManyParser , VecManyCombiner } ;
1111use crate :: map:: { MapParser , MapToUnitParser } ;
1212use crate :: map_ctx:: MapCtxParser ;
13- use crate :: map_err :: { ErrorMapper , FatalErrorOverrider , MapErrParser } ;
13+ use crate :: map_fatal_err :: MapFatalErrParser ;
1414use crate :: map_soft_err:: MapSoftErrParser ;
1515use crate :: no_context:: NoContextParser ;
1616use crate :: or_default:: OrDefaultParser ;
@@ -290,21 +290,25 @@ where
290290 }
291291
292292 // =======================================================================
293- // MapSoftErr
293+ // MapFatalErr
294294 // =======================================================================
295295
296- /// Maps the error of this parser.
296+ /// Maps the fatal error of this parser.
297297 /// If the parser is successful, the value is returned as-is.
298- /// If the parser returns an error, the given mapper is used to map the error
299- /// to a new error.
300- fn map_err < F > ( self , mapper : F ) -> MapErrParser < Self , F >
298+ /// If the parser returns a soft error, the error is returned as-is.
299+ /// If the parser returns a fatal error, it is replaced by the given error.
300+ fn map_fatal_err ( self , err : Self :: Error ) -> MapFatalErrParser < Self , Self :: Error >
301301 where
302302 Self : Sized ,
303- F : ErrorMapper < Self :: Error > ,
304303 {
305- MapErrParser :: new ( self , mapper)
304+ assert ! ( err. is_fatal( ) ) ;
305+ MapFatalErrParser :: new ( self , err)
306306 }
307307
308+ // =======================================================================
309+ // MapSoftErr
310+ // =======================================================================
311+
308312 /// If this parser returns a soft error, the soft error will be replaced by
309313 /// the given error (which might be soft or fatal).
310314 fn with_soft_err ( self , err : Self :: Error ) -> MapSoftErrParser < Self , Self :: Error >
@@ -324,19 +328,6 @@ where
324328 self . with_soft_err ( err)
325329 }
326330
327- /// If this parser returns a fatal error, the fatal error will be replaced by the given error
328- /// (which must be fatal too).
329- fn with_fatal_err (
330- self ,
331- err : Self :: Error ,
332- ) -> MapErrParser < Self , FatalErrorOverrider < Self :: Error > >
333- where
334- Self : Sized ,
335- {
336- assert ! ( err. is_fatal( ) ) ;
337- self . map_err ( FatalErrorOverrider :: new ( err) )
338- }
339-
340331 // =======================================================================
341332 // NoContext
342333 // =======================================================================
0 commit comments