pub fn seek(self, to_index: u64) -> Result<LogEntry<'l>, LogError> {
        let LogEntry { log, index } = self;

        if to_index > log.first_index + log.len || to_index < index {
            return Err(LogError::OutOfBounds);
        }

        for _ in index..to_index {
            let len = log.file.read_u64()?;

            // Move forwards through the length of the current log entry and the 4 byte checksum
            log.file
                .seek(SeekFrom::Current((len + 4).try_into().unwrap()))?;
        }

        Ok(LogEntry {
            log,
            index: to_index,
        })
    }
/// Seek forwards to the index. Only forwards traversal is allowed.
Seek forwards to the index. Only forwards traversal is allowed.
Seek forwards to the index . Only forwards traversal is allowed .
pub fn seek(self, to_index: u64) -> Result<LogEntry<'l>, LogError> {
        let LogEntry { log, index } = self;
        if to_index > log.first_index + log.len || to_index < index {
            return Err(LogError::OutOfBounds);
        }
        for _ in index..to_index {
            let len = log.file.read_u64()?;
            // Move forwards through the length of the current log entry and the 4 byte checksum
            log.file
                .seek(SeekFrom::Current((len + 4).try_into().unwrap()))?;
        }
        Ok(LogEntry {
            log,
            index: to_index,
        })
    }
pub fn seek ( self , to_index : u64 ) -> Result < LogEntry < ' l > , LogError > { let LogEntry { log , index } = self ; if to_index > log . first_index + log . len || to_index < index { return Err ( LogError :: OutOfBounds ) ; } for _ in index .. to_index { let len = log . file . read_u64 ( ) ? ; // Move forwards through the length of the current log entry and the 4 byte checksum log . file . seek ( SeekFrom :: Current ( ( len + 4 ) . try_into ( ) . unwrap ( ) ) ) ? ; } Ok ( LogEntry { log , index : to_index , } ) }
Seek forwards to the index.
Seek forwards to the index .
self
to_index
u64