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

    let do_parse = || {
        RE.captures(archive_filename).and_then(|captures| {
            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((slot, hash, archive_format))
        })
    };

    do_parse().ok_or_else(|| {
        SnapshotError::ParseSnapshotArchiveFileNameError(archive_filename.to_string())
    })
}
/// Parse a full snapshot archive filename into its Slot, Hash, and Archive Format
Parse a full snapshot archive filename into its Slot, Hash, and Archive Format
Parse a full snapshot archive filename into its Slot Hash and Archive Format
pub fn parse_full_snapshot_archive_filename(
    archive_filename: &str,
) -> Result<(Slot, Hash, ArchiveFormat)> {
    lazy_static! {
        static ref RE: Regex = Regex::new(FULL_SNAPSHOT_ARCHIVE_FILENAME_REGEX).unwrap();
    }
    let do_parse = || {
        RE.captures(archive_filename).and_then(|captures| {
            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((slot, hash, archive_format))
        })
    };
    do_parse().ok_or_else(|| {
        SnapshotError::ParseSnapshotArchiveFileNameError(archive_filename.to_string())
    })
}
pub fn parse_full_snapshot_archive_filename ( archive_filename : & str , ) -> Result < ( Slot , Hash , ArchiveFormat ) > { lazy_static ! { static ref RE Regex Regex new ( FULL_SNAPSHOT_ARCHIVE_FILENAME_REGEX ) unwrap ( ) } let do_parse = | | { RE . captures ( archive_filename ) . and_then ( | captures | { 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 ( ( slot , hash , archive_format ) ) } ) } ; do_parse ( ) . ok_or_else ( | | { SnapshotError :: ParseSnapshotArchiveFileNameError ( archive_filename . to_string ( ) ) } ) }
Parse a full snapshot archive filename into its Slot, Hash, and Archive Format
Parse a full snapshot archive filename into its Slot Hash and Archive Format
archive_filename
&str