pub fn compare_elements(path1: &Path, path2: &Path) -> Result<(), Error> {
        info!("Comparing elements between {:?} and {:?}", path1, path2);
        let f_data1 = OpenOptions::new().read(true).open(path1)?;
        let data1 = unsafe { MmapOptions::new().map(&f_data1) }?;
        let f_data2 = OpenOptions::new().read(true).open(path2)?;
        let data2 = unsafe { MmapOptions::new().map(&f_data2) }?;
        let fr_size = std::mem::size_of::<Fr>() as usize;
        let end = metadata(path1)?.len() as u64;
        ensure!(
            metadata(path2)?.len() as u64 == end,
            "File sizes must match"
        );

        for i in (0..end).step_by(fr_size) {
            let index = i as usize;
            let fr1 = bytes_into_fr(&data1[index..index + fr_size])?;
            let fr2 = bytes_into_fr(&data2[index..index + fr_size])?;
            ensure!(fr1 == fr2, "Data mismatch when comparing elements");
        }
        info!("Match found for {:?} and {:?}", path1, path2);

        Ok(())
    }
// This is a test method for ensuring that the elements of 1 file
// matches the other.
This is a test method for ensuring that the elements of 1 file
matches the other.
This is a test method for ensuring that the elements of 1 file matches the other .
pub fn compare_elements(path1: &Path, path2: &Path) -> Result<(), Error> {
        info!("Comparing elements between {:?} and {:?}", path1, path2);
        let f_data1 = OpenOptions::new().read(true).open(path1)?;
        let data1 = unsafe { MmapOptions::new().map(&f_data1) }?;
        let f_data2 = OpenOptions::new().read(true).open(path2)?;
        let data2 = unsafe { MmapOptions::new().map(&f_data2) }?;
        let fr_size = std::mem::size_of::<Fr>() as usize;
        let end = metadata(path1)?.len() as u64;
        ensure!(
            metadata(path2)?.len() as u64 == end,
            "File sizes must match"
        );
        for i in (0..end).step_by(fr_size) {
            let index = i as usize;
            let fr1 = bytes_into_fr(&data1[index..index + fr_size])?;
            let fr2 = bytes_into_fr(&data2[index..index + fr_size])?;
            ensure!(fr1 == fr2, "Data mismatch when comparing elements");
        }
        info!("Match found for {:?} and {:?}", path1, path2);
        Ok(())
    }
pub fn compare_elements ( path1 : & Path , path2 : & Path ) -> Result < ( ) , Error > { info ! ( " " path1 path2 ) ; let f_data1 = OpenOptions :: new ( ) . read ( true ) . open ( path1 ) ? ; let data1 = unsafe { MmapOptions :: new ( ) . map ( & f_data1 ) } ? ; let f_data2 = OpenOptions :: new ( ) . read ( true ) . open ( path2 ) ? ; let data2 = unsafe { MmapOptions :: new ( ) . map ( & f_data2 ) } ? ; let fr_size = std :: mem :: size_of :: < Fr > ( ) as usize ; let end = metadata ( path1 ) ? . len ( ) as u64 ; ensure ! ( metadata ( path2 ) len ( ) as u64 end " " ) ; for i in ( 0 .. end ) . step_by ( fr_size ) { let index = i as usize ; let fr1 = bytes_into_fr ( & data1 [ index .. index + fr_size ] ) ? ; let fr2 = bytes_into_fr ( & data2 [ index .. index + fr_size ] ) ? ; ensure ! ( fr1 fr2 " " ) ; } info ! ( " " path1 path2 ) ; Ok ( ( ) ) }
This is a test method for ensuring that the elements of 1 file
matches the other.
This is a test method for ensuring that the elements of 1 file matches the other .
path1
&Path
path2
&Path
path1
&Path
path2
&Path