ProgressCallback

Trait ProgressCallback 

Source
pub trait ProgressCallback: Send + Sync {
    // Required methods
    fn inc(&self, n: u64);
    fn parsing_started(&self, path: &str);
}
Expand description

Trait for receiving progress updates during data parsing.

Implement this trait to display a progress bar, log progress, or perform any other action when the parser makes forward progress.

§Example

use std::sync::Arc;
use readstat::ProgressCallback;

struct LogProgress;

impl ProgressCallback for LogProgress {
    fn inc(&self, n: u64) {
        println!("Processed {n} more rows");
    }
    fn parsing_started(&self, path: &str) {
        println!("Parsing file: {path}");
    }
}

Required Methods§

Source

fn inc(&self, n: u64)

Called to report that n additional rows have been processed.

Source

fn parsing_started(&self, path: &str)

Called when parsing begins for the file at path.

Implementors§