fn guess_sparse(&self) -> io::Result<bool> {
        // not worth the effort
        if self.size <= 2 << CHUNKSZ_LOG {
            return Ok(false);
        }
        let mut buf = vec![0; CHUNKSZ];
        let mut dev = File::open(&self.path)?;
        for chunk in RandomSample::new(pos2chunk(self.size)) {
            dev.seek(io::SeekFrom::Start(chunk2pos(chunk)))?;
            dev.read_exact(&mut buf)?;
            if *buf != ZERO_CHUNK[..] {
                return Ok(false);
            }
        }
        Ok(true)
    }
// Heuristic: read the first and the last chunk and 1% of the chunks in between. If there
// is any non-zero data detected, this device has not been discarded and must be writte in
// non-sparse mode.
read the first and the last chunk and 1% of the chunks in between. If there
is any non-zero data detected, this device has not been discarded and must be writte in
non-sparse mode.
read the first and the last chunk and 1% of the chunks in between . If there is any non - zero data detected this device has not been discarded and must be writte in non - sparse mode .
fn guess_sparse(&self) -> io::Result<bool> {
        // not worth the effort
        if self.size <= 2 << CHUNKSZ_LOG {
            return Ok(false);
        }
        let mut buf = vec![0; CHUNKSZ];
        let mut dev = File::open(&self.path)?;
        for chunk in RandomSample::new(pos2chunk(self.size)) {
            dev.seek(io::SeekFrom::Start(chunk2pos(chunk)))?;
            dev.read_exact(&mut buf)?;
            if *buf != ZERO_CHUNK[..] {
                return Ok(false);
            }
        }
        Ok(true)
    }
fn guess_sparse ( & self ) -> io :: Result < bool > { // not worth the effort if self . size <= 2 << CHUNKSZ_LOG { return Ok ( false ) ; } let mut buf = vec ! [ 0 CHUNKSZ ] ; let mut dev = File :: open ( & self . path ) ? ; for chunk in RandomSample :: new ( pos2chunk ( self . size ) ) { dev . seek ( io :: SeekFrom :: Start ( chunk2pos ( chunk ) ) ) ? ; dev . read_exact ( & mut buf ) ? ; if * buf != ZERO_CHUNK [ .. ] { return Ok ( false ) ; } } Ok ( true ) }
Heuristic: read the first and the last chunk and 1% of the chunks in between.
Heuristic : read the first and the last chunk and 1% of the chunks in between .
&self
&self