MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/splashsurf / bgeo_error

Function bgeo_error

splashsurf_lib/src/io/bgeo_format.rs:846–860  ·  view source on GitHub ↗

Parser that attaches an error of the given [BgeoParserErrorKind] if the inner parser fails

(
        kind: BgeoParserErrorKind,
        mut f: F,
    )

Source from the content-addressed store, hash-verified

844
845 /// Parser that attaches an error of the given [BgeoParserErrorKind] if the inner parser fails
846 pub fn bgeo_error<I: Clone, F, O>(
847 kind: BgeoParserErrorKind,
848 mut f: F,
849 ) -> impl FnMut(I) -> IResult<I, O, BgeoParserError<I>>
850 where
851 F: Parser<I, Output = O, Error = BgeoParserError<I>>,
852 {
853 use nom::Err;
854 move |i: I| match f.parse(i.clone()) {
855 Ok(o) => Ok(o),
856 Err(Err::Incomplete(i)) => Err(Err::Incomplete(i)),
857 Err(Err::Error(e)) => Err(Err::Error(e.with_append(i, kind.clone()))),
858 Err(Err::Failure(e)) => Err(Err::Failure(e.with_append(i, kind.clone()))),
859 }
860 }
861}
862
863#[test]

Callers 3

parse_header_magicFunction · 0.85
parse_versionFunction · 0.85
parse_attr_defFunction · 0.85

Calls 3

parseMethod · 0.80
cloneMethod · 0.80
with_appendMethod · 0.80

Tested by

no test coverage detected