pub fn parse<R>(mut source: R, path: Option<PathBuf>, load_files: bool) -> Result<ParsedRun>
where
    R: BufRead + Seek,
{
    let files_path = if load_files { path.clone() } else { None };

    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = livesplit::parse(&mut source, path) {
        return Ok(parsed(run, TimerKind::LiveSplit));
    }

    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = wsplit::parse(&mut source, load_files) {
        return Ok(parsed(run, TimerKind::WSplit));
    }

    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = splitterz::parse(&mut source, load_files) {
        return Ok(parsed(run, TimerKind::SplitterZ));
    }

    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = shit_split::parse(&mut source) {
        return Ok(parsed(run, TimerKind::ShitSplit));
    }

    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = splitty::parse(&mut source) {
        return Ok(parsed(run, TimerKind::Splitty));
    }

    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = time_split_tracker::parse(&mut source, files_path) {
        return Ok(parsed(run, TimerKind::TimeSplitTracker));
    }

    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = portal2_live_timer::parse(&mut source) {
        return Ok(parsed(run, TimerKind::Portal2LiveTimer));
    }

    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = face_split::parse(&mut source, load_files) {
        return Ok(parsed(run, TimerKind::FaceSplit));
    }

    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = llanfair::parse(&mut source) {
        return Ok(parsed(run, TimerKind::Llanfair));
    }

    // Should be parsed after LiveSplit's parser, as it also parses all
    // LiveSplit files with the current implementation.
    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = llanfair_gered::parse(&mut source) {
        return Ok(parsed(run, TimerKind::LlanfairGered));
    }

    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok((run, timer)) = splits_io::parse(&mut source) {
        return Ok(parsed(run, TimerKind::Generic(timer)));
    }

    // Splitterino, SourceLiveTimer and Flitter need to be before Urn because of
    // a false positive due to the nature of parsing json files.
    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = splitterino::parse(&mut source) {
        return Ok(parsed(run, TimerKind::Splitterino));
    }

    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = flitter::parse(&mut source) {
        return Ok(parsed(run, TimerKind::Flitter));
    }

    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = source_live_timer::parse(&mut source) {
        return Ok(parsed(run, TimerKind::SourceLiveTimer));
    }

    // Urn accepts entirely empty JSON files.
    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = urn::parse(&mut source) {
        return Ok(parsed(run, TimerKind::Urn));
    }

    Err(Error::NoParserParsedIt)
}
/// Attempts to parse a splits file by invoking the corresponding parser for the
/// file format detected. A path to the splits file can be provided, which helps
/// saving the splits file again later. Additionally you need to specify if
/// additional files, like external images are allowed to be loaded. If you are
/// using livesplit-core in a server-like environment, set this to `false`. Only
/// client-side applications should set this to `true`.
Attempts to parse a splits file by invoking the corresponding parser for the
file format detected. A path to the splits file can be provided, which helps
saving the splits file again later. Additionally you need to specify if
additional files, like external images are allowed to be loaded. If you are
using livesplit-core in a server-like environment, set this to `false`. Only
client-side applications should set this to `true`.
Attempts to parse a splits file by invoking the corresponding parser for the file format detected . A path to the splits file can be provided which helps saving the splits file again later . Additionally you need to specify if additional files like external images are allowed to be loaded . If you are using livesplit - core in a server - like environment set this to ` false ` . Only client - side applications should set this to ` true ` .
pub fn parse<R>(mut source: R, path: Option<PathBuf>, load_files: bool) -> Result<ParsedRun>
where
    R: BufRead + Seek,
{
    let files_path = if load_files { path.clone() } else { None };
    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = livesplit::parse(&mut source, path) {
        return Ok(parsed(run, TimerKind::LiveSplit));
    }
    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = wsplit::parse(&mut source, load_files) {
        return Ok(parsed(run, TimerKind::WSplit));
    }
    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = splitterz::parse(&mut source, load_files) {
        return Ok(parsed(run, TimerKind::SplitterZ));
    }
    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = shit_split::parse(&mut source) {
        return Ok(parsed(run, TimerKind::ShitSplit));
    }
    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = splitty::parse(&mut source) {
        return Ok(parsed(run, TimerKind::Splitty));
    }
    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = time_split_tracker::parse(&mut source, files_path) {
        return Ok(parsed(run, TimerKind::TimeSplitTracker));
    }
    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = portal2_live_timer::parse(&mut source) {
        return Ok(parsed(run, TimerKind::Portal2LiveTimer));
    }
    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = face_split::parse(&mut source, load_files) {
        return Ok(parsed(run, TimerKind::FaceSplit));
    }
    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = llanfair::parse(&mut source) {
        return Ok(parsed(run, TimerKind::Llanfair));
    }
    // Should be parsed after LiveSplit's parser, as it also parses all
    // LiveSplit files with the current implementation.
    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = llanfair_gered::parse(&mut source) {
        return Ok(parsed(run, TimerKind::LlanfairGered));
    }
    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok((run, timer)) = splits_io::parse(&mut source) {
        return Ok(parsed(run, TimerKind::Generic(timer)));
    }
    // Splitterino, SourceLiveTimer and Flitter need to be before Urn because of
    // a false positive due to the nature of parsing json files.
    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = splitterino::parse(&mut source) {
        return Ok(parsed(run, TimerKind::Splitterino));
    }
    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = flitter::parse(&mut source) {
        return Ok(parsed(run, TimerKind::Flitter));
    }
    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = source_live_timer::parse(&mut source) {
        return Ok(parsed(run, TimerKind::SourceLiveTimer));
    }
    // Urn accepts entirely empty JSON files.
    source.seek(SeekFrom::Start(0)).context(SeekBack)?;
    if let Ok(run) = urn::parse(&mut source) {
        return Ok(parsed(run, TimerKind::Urn));
    }
    Err(Error::NoParserParsedIt)
}
pub fn parse < R > ( mut source : R , path : Option < PathBuf > , load_files : bool ) -> Result < ParsedRun > where R : BufRead + Seek , { let files_path = if load_files { path . clone ( ) } else { None } ; source . seek ( SeekFrom :: Start ( 0 ) ) . context ( SeekBack ) ? ; if let Ok ( run ) = livesplit :: parse ( & mut source , path ) { return Ok ( parsed ( run , TimerKind :: LiveSplit ) ) ; } source . seek ( SeekFrom :: Start ( 0 ) ) . context ( SeekBack ) ? ; if let Ok ( run ) = wsplit :: parse ( & mut source , load_files ) { return Ok ( parsed ( run , TimerKind :: WSplit ) ) ; } source . seek ( SeekFrom :: Start ( 0 ) ) . context ( SeekBack ) ? ; if let Ok ( run ) = splitterz :: parse ( & mut source , load_files ) { return Ok ( parsed ( run , TimerKind :: SplitterZ ) ) ; } source . seek ( SeekFrom :: Start ( 0 ) ) . context ( SeekBack ) ? ; if let Ok ( run ) = shit_split :: parse ( & mut source ) { return Ok ( parsed ( run , TimerKind :: ShitSplit ) ) ; } source . seek ( SeekFrom :: Start ( 0 ) ) . context ( SeekBack ) ? ; if let Ok ( run ) = splitty :: parse ( & mut source ) { return Ok ( parsed ( run , TimerKind :: Splitty ) ) ; } source . seek ( SeekFrom :: Start ( 0 ) ) . context ( SeekBack ) ? ; if let Ok ( run ) = time_split_tracker :: parse ( & mut source , files_path ) { return Ok ( parsed ( run , TimerKind :: TimeSplitTracker ) ) ; } source . seek ( SeekFrom :: Start ( 0 ) ) . context ( SeekBack ) ? ; if let Ok ( run ) = portal2_live_timer :: parse ( & mut source ) { return Ok ( parsed ( run , TimerKind :: Portal2LiveTimer ) ) ; } source . seek ( SeekFrom :: Start ( 0 ) ) . context ( SeekBack ) ? ; if let Ok ( run ) = face_split :: parse ( & mut source , load_files ) { return Ok ( parsed ( run , TimerKind :: FaceSplit ) ) ; } source . seek ( SeekFrom :: Start ( 0 ) ) . context ( SeekBack ) ? ; if let Ok ( run ) = llanfair :: parse ( & mut source ) { return Ok ( parsed ( run , TimerKind :: Llanfair ) ) ; } // Should be parsed after LiveSplit's parser, as it also parses all // LiveSplit files with the current implementation. source . seek ( SeekFrom :: Start ( 0 ) ) . context ( SeekBack ) ? ; if let Ok ( run ) = llanfair_gered :: parse ( & mut source ) { return Ok ( parsed ( run , TimerKind :: LlanfairGered ) ) ; } source . seek ( SeekFrom :: Start ( 0 ) ) . context ( SeekBack ) ? ; if let Ok ( ( run , timer ) ) = splits_io :: parse ( & mut source ) { return Ok ( parsed ( run , TimerKind :: Generic ( timer ) ) ) ; } // Splitterino, SourceLiveTimer and Flitter need to be before Urn because of // a false positive due to the nature of parsing json files. source . seek ( SeekFrom :: Start ( 0 ) ) . context ( SeekBack ) ? ; if let Ok ( run ) = splitterino :: parse ( & mut source ) { return Ok ( parsed ( run , TimerKind :: Splitterino ) ) ; } source . seek ( SeekFrom :: Start ( 0 ) ) . context ( SeekBack ) ? ; if let Ok ( run ) = flitter :: parse ( & mut source ) { return Ok ( parsed ( run , TimerKind :: Flitter ) ) ; } source . seek ( SeekFrom :: Start ( 0 ) ) . context ( SeekBack ) ? ; if let Ok ( run ) = source_live_timer :: parse ( & mut source ) { return Ok ( parsed ( run , TimerKind :: SourceLiveTimer ) ) ; } // Urn accepts entirely empty JSON files. source . seek ( SeekFrom :: Start ( 0 ) ) . context ( SeekBack ) ? ; if let Ok ( run ) = urn :: parse ( & mut source ) { return Ok ( parsed ( run , TimerKind :: Urn ) ) ; } Err ( Error :: NoParserParsedIt ) }
Attempts to parse a splits file by invoking the corresponding parser for the
file format detected.
Attempts to parse a splits file by invoking the corresponding parser for the file format detected .
source
R
path
Option<PathBuf>
load_files
bool
source
R
path
Option<PathBuf>
load_files
bool