pub struct RobustCsvParser {
pub flexible: bool,
pub quote_char: Option<u8>,
pub delimiter: Option<u8>,
pub allow_variable_columns: bool,
pub trim_whitespace: bool,
pub auto_recovery: bool,
pub retry_config: RetryConfig,
pub verbosity: u8,
}Expand description
Robust CSV parser that handles edge cases and malformed data.
Fields§
§flexible: bool§quote_char: Option<u8>§delimiter: Option<u8>§allow_variable_columns: bool§trim_whitespace: bool§auto_recovery: bool§retry_config: RetryConfig§verbosity: u8Implementations§
Source§impl RobustCsvParser
impl RobustCsvParser
pub fn new() -> Self
pub fn flexible(self, flexible: bool) -> Self
pub fn allow_variable_columns(self, allow: bool) -> Self
Sourcepub fn verbosity(self, level: u8) -> Self
pub fn verbosity(self, level: u8) -> Self
Set verbosity level for logging. 0=quiet, 1=normal, 2=verbose, 3=debug
Sourcepub fn with_auto_recovery(self, enabled: bool) -> Self
pub fn with_auto_recovery(self, enabled: bool) -> Self
Enable or disable auto-recovery features.
Sourcepub fn with_retry_config(self, config: RetryConfig) -> Self
pub fn with_retry_config(self, config: RetryConfig) -> Self
Set custom retry configuration.
Sourcepub fn detect_encoding(&self, file_path: &Path) -> Result<&'static str>
pub fn detect_encoding(&self, file_path: &Path) -> Result<&'static str>
Detect encoding by analyzing file bytes.
Sourcepub fn parse_csv_with_recovery(
&self,
file_path: &Path,
) -> Result<CsvParseOutput>
pub fn parse_csv_with_recovery( &self, file_path: &Path, ) -> Result<CsvParseOutput>
Enhanced parsing with auto-recovery.
Sourcepub fn detect_delimiter(&self, file_path: &Path) -> Result<u8>
pub fn detect_delimiter(&self, file_path: &Path) -> Result<u8>
Detect delimiter by sampling the file.
Delegates to the shared quote-aware sniffer so both parsers agree on the delimiter for the same file.
Sourcepub fn parse_csv(&self, file_path: &Path) -> Result<CsvParseOutput>
pub fn parse_csv(&self, file_path: &Path) -> Result<CsvParseOutput>
Parse CSV with robust error handling.
Sourcepub fn parse_csv_chunk(
&self,
data: &str,
delimiter: u8,
has_headers: bool,
) -> Result<RobustParseResult>
pub fn parse_csv_chunk( &self, data: &str, delimiter: u8, has_headers: bool, ) -> Result<RobustParseResult>
Parse a specific chunk of CSV data.
Sourcepub fn validate_csv(&self, file_path: &Path) -> Result<CsvDiagnostics>
pub fn validate_csv(&self, file_path: &Path) -> Result<CsvDiagnostics>
Validate CSV structure and provide diagnostic information.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RobustCsvParser
impl RefUnwindSafe for RobustCsvParser
impl Send for RobustCsvParser
impl Sync for RobustCsvParser
impl Unpin for RobustCsvParser
impl UnsafeUnpin for RobustCsvParser
impl UnwindSafe for RobustCsvParser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more