pub fn parse_incremental_snapshot_archive_filename(
    archive_filename: &str,
) -> Result<(Slot, Slot, Hash, ArchiveFormat)> {
    lazy_static! {
        static ref RE: Regex = Regex::new(INCREMENTAL_SNAPSHOT_ARCHIVE_FILENAME_REGEX).unwrap();
    }

    let do_parse = || {
        RE.captures(archive_filename).and_then(|captures| {
            let base_slot = captures
                .name("base")
                .map(|x| x.as_str().parse::<Slot>())?
                .ok()?;
            let slot = captures
                .name("slot")
                .map(|x| x.as_str().parse::<Slot>())?
                .ok()?;
            let hash = captures
                .name("hash")
                .map(|x| x.as_str().parse::<Hash>())?
                .ok()?;
            let archive_format = captures
                .name("ext")
                .map(|x| archive_format_from_str(x.as_str()))??;

            Some((base_slot, slot, hash, archive_format))
        })
    };

    do_parse().ok_or_else(|| {
        SnapshotError::ParseSnapshotArchiveFileNameError(archive_filename.to_string())
    })
}
/// Parse an incremental snapshot archive filename into its base Slot, actual Slot, Hash, and Archive Format
Parse an incremental snapshot archive filename into its base Slot, actual Slot, Hash, and Archive Format
Parse an incremental snapshot archive filename into its base Slot actual Slot Hash and Archive Format
pub fn parse_incremental_snapshot_archive_filename(
    archive_filename: &str,
) -> Result<(Slot, Slot, Hash, ArchiveFormat)> {
    lazy_static! {
        static ref RE: Regex = Regex::new(INCREMENTAL_SNAPSHOT_ARCHIVE_FILENAME_REGEX).unwrap();
    }
    let do_parse = || {
        RE.captures(archive_filename).and_then(|captures| {
            let base_slot = captures
                .name("base")
                .map(|x| x.as_str().parse::<Slot>())?
                .ok()?;
            let slot = captures
                .name("slot")
                .map(|x| x.as_str().parse::<Slot>())?
                .ok()?;
            let hash = captures
                .name("hash")
                .map(|x| x.as_str().parse::<Hash>())?
                .ok()?;
            let archive_format = captures
                .name("ext")
                .map(|x| archive_format_from_str(x.as_str()))??;
            Some((base_slot, slot, hash, archive_format))
        })
    };
    do_parse().ok_or_else(|| {
        SnapshotError::ParseSnapshotArchiveFileNameError(archive_filename.to_string())
    })
}
pub fn parse_incremental_snapshot_archive_filename ( archive_filename : & str , ) -> Result < ( Slot , Slot , Hash , ArchiveFormat ) > { lazy_static ! { static ref RE Regex Regex new ( INCREMENTAL_SNAPSHOT_ARCHIVE_FILENAME_REGEX ) unwrap ( ) } let do_parse = | | { RE . captures ( archive_filename ) . and_then ( | captures | { let base_slot = captures . name ( " " ) . map ( | x | x . as_str ( ) . parse :: < Slot > ( ) ) ? . ok ( ) ? ; let slot = captures . name ( " " ) . map ( | x | x . as_str ( ) . parse :: < Slot > ( ) ) ? . ok ( ) ? ; let hash = captures . name ( " " ) . map ( | x | x . as_str ( ) . parse :: < Hash > ( ) ) ? . ok ( ) ? ; let archive_format = captures . name ( " " ) . map ( | x | archive_format_from_str ( x . as_str ( ) ) ) ? ? ; Some ( ( base_slot , slot , hash , archive_format ) ) } ) } ; do_parse ( ) . ok_or_else ( | | { SnapshotError :: ParseSnapshotArchiveFileNameError ( archive_filename . to_string ( ) ) } ) }
Parse an incremental snapshot archive filename into its base Slot, actual Slot, Hash, and Archive Format
Parse an incremental snapshot archive filename into its base Slot actual Slot Hash and Archive Format
archive_filename
&str