fn check_header<I: Read>(input: &mut I) -> crate::Result<()> {
    // check the magic bytes
    let mut magic = [0u8; 5];
    input.read_exact(&mut magic)?;
    if magic != MAGIC {
        return Err(crate::Error::SnapshotError(
            "magic bytes mismatch, is this really a snapshot file?".into(),
        ));
    }

    // check the version
    let mut version = [0u8; 2];
    input.read_exact(&mut version)?;

    if version != VERSION {
        return Err(crate::Error::SnapshotError("snapshot version is incorrect".into()));
    }

    Ok(())
}
/// Checks the header for a specific structure; explicitly the magic and version bytes.
Checks the header for a specific structure; explicitly the magic and version bytes.
Checks the header for a specific structure ; explicitly the magic and version bytes .
fn check_header<I: Read>(input: &mut I) -> crate::Result<()> {
    // check the magic bytes
    let mut magic = [0u8; 5];
    input.read_exact(&mut magic)?;
    if magic != MAGIC {
        return Err(crate::Error::SnapshotError(
            "magic bytes mismatch, is this really a snapshot file?".into(),
        ));
    }
    // check the version
    let mut version = [0u8; 2];
    input.read_exact(&mut version)?;
    if version != VERSION {
        return Err(crate::Error::SnapshotError("snapshot version is incorrect".into()));
    }
    Ok(())
}
fn check_header < I : Read > ( input : & mut I ) -> crate :: Result < ( ) > { // check the magic bytes let mut magic = [ 0u8 ; 5 ] ; input . read_exact ( & mut magic ) ? ; if magic != MAGIC { return Err ( crate :: Error :: SnapshotError ( " " . into ( ) , ) ) ; } // check the version let mut version = [ 0u8 ; 2 ] ; input . read_exact ( & mut version ) ? ; if version != VERSION { return Err ( crate :: Error :: SnapshotError ( " " . into ( ) ) ) ; } Ok ( ( ) ) }
Checks the header for a specific structure; explicitly the magic and version bytes.
Checks the header for a specific structure ; explicitly the magic and version bytes .
input
&mut I
input
&mut I