Skip to main content

RobustCsvParser

Struct RobustCsvParser 

Source
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: u8

Implementations§

Source§

impl RobustCsvParser

Source

pub fn new() -> Self

Source

pub fn flexible(self, flexible: bool) -> Self

Source

pub fn allow_variable_columns(self, allow: bool) -> Self

Source

pub fn verbosity(self, level: u8) -> Self

Set verbosity level for logging. 0=quiet, 1=normal, 2=verbose, 3=debug

Source

pub fn with_auto_recovery(self, enabled: bool) -> Self

Enable or disable auto-recovery features.

Source

pub fn with_retry_config(self, config: RetryConfig) -> Self

Set custom retry configuration.

Source

pub fn detect_encoding(&self, file_path: &Path) -> Result<&'static str>

Detect encoding by analyzing file bytes.

Source

pub fn parse_csv_with_recovery( &self, file_path: &Path, ) -> Result<(Vec<String>, Vec<Vec<String>>)>

Enhanced parsing with auto-recovery.

Source

pub fn detect_delimiter(&self, file_path: &Path) -> Result<u8>

Detect delimiter by sampling the file.

Source

pub fn parse_csv( &self, file_path: &Path, ) -> Result<(Vec<String>, Vec<Vec<String>>)>

Parse CSV with robust error handling.

Source

pub fn parse_csv_chunk( &self, data: &str, delimiter: u8, has_headers: bool, ) -> Result<RobustParseResult>

Parse a specific chunk of CSV data.

Source

pub fn validate_csv(&self, file_path: &Path) -> Result<CsvDiagnostics>

Validate CSV structure and provide diagnostic information.

Trait Implementations§

Source§

impl Default for RobustCsvParser

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V