mirror of
https://github.com/rzmk/czv.git
synced 2025-12-19 08:09:24 +00:00
- Add `file_path` for czv-python count operations - Refactor tests based on file path instead of data - Use thiserror in czv - Update examples to reflect changes
21 lines
510 B
Rust
21 lines
510 B
Rust
use crate::Result;
|
|
use pyo3::pyfunction;
|
|
use std::path::PathBuf;
|
|
|
|
#[pyfunction]
|
|
pub fn row_count(
|
|
file_path: Option<PathBuf>,
|
|
file_data: Option<String>,
|
|
include_header_row: Option<bool>,
|
|
) -> Result<usize> {
|
|
Ok(czv::count::row_count(
|
|
file_path,
|
|
file_data,
|
|
include_header_row.unwrap_or(false),
|
|
)?)
|
|
}
|
|
|
|
#[pyfunction]
|
|
pub fn column_count(file_path: Option<PathBuf>, file_data: Option<String>) -> Result<usize> {
|
|
Ok(czv::count::column_count(file_path, file_data)?)
|
|
}
|