Skip to main content

FileProcessor

Trait FileProcessor 

Source
pub trait FileProcessor {
    // Required methods
    fn process_lines<F>(&mut self, line_processor: F) -> Result<(), TaleError>
       where F: FnMut(&str) -> Result<(), TaleError>;
    fn skip_lines(&mut self, count: u64) -> Result<(), TaleError>;
    fn file_size(&self) -> u64;
    fn seek(&mut self, pos: SeekFrom) -> Result<u64, TaleError>;
    fn position(&self) -> u64;
}
Expand description

Trait for abstracting different file reading strategies

Required Methods§

Source

fn process_lines<F>(&mut self, line_processor: F) -> Result<(), TaleError>
where F: FnMut(&str) -> Result<(), TaleError>,

Process the entire file, calling the provided closure for each line

Source

fn skip_lines(&mut self, count: u64) -> Result<(), TaleError>

Skip a specified number of lines from the current position

Source

fn file_size(&self) -> u64

Get the file size in bytes

Source

fn seek(&mut self, pos: SeekFrom) -> Result<u64, TaleError>

Seek to a specific position in the file

Source

fn position(&self) -> u64

Get current position in the file

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§