veloxx 0.4.0

Veloxx: High-performance, lightweight Rust library for in-memory data processing and analytics. Features DataFrames, Series, advanced I/O (CSV, JSON, Parquet), machine learning (linear regression, K-means, logistic regression), time-series analysis, data visualization, parallel processing, and multi-platform bindings (Python, WebAssembly). Designed for minimal dependencies, optimal memory usage, and blazing speed - ideal for data science, analytics, and performance-critical applications.
Documentation
#[cfg(all(feature = "arrow", not(target_arch = "wasm32")))]
pub mod arrow;
pub mod csv;
pub mod json;
pub mod mmap_csv;

use crate::dataframe::DataFrame;
use crate::VeloxxError;

// Re-export the new ultra-fast parsers
pub use csv::UltraFastCsvParser;
pub use json::UltraFastJsonParser;
pub use mmap_csv::MemoryMappedCsvParser;

#[derive(Default)]
pub struct CsvReader;
#[derive(Default)]
pub struct JsonWriter;

impl CsvReader {
    pub fn new() -> Self {
        CsvReader
    }

    pub fn read_file(&self, _path: &str) -> Result<DataFrame, VeloxxError> {
        #[cfg(all(feature = "arrow", not(target_arch = "wasm32")))]
        {
            arrow::read_csv_to_dataframe(_path)
        }
        #[cfg(any(target_arch = "wasm32", not(feature = "arrow")))]
        {
            Err(VeloxxError::Unsupported(
                "File I/O not supported in WASM builds".to_string(),
            ))
        }
    }

    pub fn read_string(&self, _s: &str) -> Option<DataFrame> {
        // ...existing code...
        Some(DataFrame::new(indexmap::IndexMap::new()))
    }

    pub fn stream_string(&self, _s: &str, _n: usize) -> Option<DataFrame> {
        // ...existing code...
        Some(DataFrame::new(indexmap::IndexMap::new()))
    }
}

#[derive(Default)]
pub struct ParquetReader;

impl ParquetReader {
    pub fn new() -> Self {
        ParquetReader
    }

    #[cfg(feature = "advanced_io")]
    pub fn read_file(&self, path: &str) -> Result<DataFrame, VeloxxError> {
        #[cfg(all(feature = "arrow", not(target_arch = "wasm32")))]
        {
            arrow::read_parquet_to_dataframe(path)
        }
        #[cfg(any(target_arch = "wasm32", not(feature = "arrow")))]
        {
            Err(VeloxxError::Unsupported(
                "File I/O not supported in WASM builds".to_string(),
            ))
        }
    }

    #[cfg(not(feature = "advanced_io"))]
    pub fn read_file(&self, _path: &str) -> Result<DataFrame, VeloxxError> {
        Err(VeloxxError::Unsupported(
            "Parquet support requires advanced_io feature".to_string(),
        ))
    }
}

impl JsonWriter {
    pub fn new() -> Self {
        JsonWriter
    }

    pub fn pretty() -> Self {
        JsonWriter
    }

    pub fn write_file(&self, _df: &DataFrame, _path: &str) -> Result<(), VeloxxError> {
        Ok(())
    }

    pub fn write_string(&self, _df: &DataFrame) -> Option<String> {
        Some(String::new())
    }
}