pub fn validate(&mut self) -> Result<bool, DatabaseError> {
        let mut buf = Vec::new();
        self.file.seek(SeekFrom::Start(0))?;
        self.file.read_to_end(&mut buf)?;
        if buf.is_empty() {
            return Ok(true);
        }
        match process_document(&mut buf.as_slice()) {
            Ok(_) => Ok(true),
            Err(e) if matches!(e, DatabaseError::MismatchedChecksum { .. }) => Ok(false),
            Err(e) => Err(e),
        }
    }
/// Validates if the checksum of the documents in the collection matches its
/// corresponding stored checksum value. This is an efficient way to determine
/// if a file has possibly been corrupted. Returns `Ok(true)` if the file has
/// no checksum mismatches and `Ok(false)` if the opposite is true.
///
/// # Errors
///
/// - `std::io::Error`
Validates if the checksum of the documents in the collection matches its
corresponding stored checksum value. This is an efficient way to determine
if a file has possibly been corrupted. Returns `Ok(true)` if the file has
no checksum mismatches and `Ok(false)` if the opposite is true.
Validates if the checksum of the documents in the collection matches its corresponding stored checksum value . This is an efficient way to determine if a file has possibly been corrupted . Returns ` Ok ( true ) ` if the file has no checksum mismatches and ` Ok ( false ) ` if the opposite is true .
pub fn validate(&mut self) -> Result<bool, DatabaseError> {
        let mut buf = Vec::new();
        self.file.seek(SeekFrom::Start(0))?;
        self.file.read_to_end(&mut buf)?;
        if buf.is_empty() {
            return Ok(true);
        }
        match process_document(&mut buf.as_slice()) {
            Ok(_) => Ok(true),
            Err(e) if matches!(e, DatabaseError::MismatchedChecksum { .. }) => Ok(false),
            Err(e) => Err(e),
        }
    }
pub fn validate ( & mut self ) -> Result < bool , DatabaseError > { let mut buf = Vec :: new ( ) ; self . file . seek ( SeekFrom :: Start ( 0 ) ) ? ; self . file . read_to_end ( & mut buf ) ? ; if buf . is_empty ( ) { return Ok ( true ) ; } match process_document ( & mut buf . as_slice ( ) ) { Ok ( _ ) => Ok ( true ) , Err ( e ) if matches ! ( e DatabaseError MismatchedChecksum { } ) => Ok ( false ) , Err ( e ) => Err ( e ) , } }
Validates if the checksum of the documents in the collection matches its
corresponding stored checksum value.
Validates if the checksum of the documents in the collection matches its corresponding stored checksum value .
&mut self
&mut self
errors
None