From 2c9d9c7de768bc5aa94ced8b3a0452f1a23303ff Mon Sep 17 00:00:00 2001 From: Edward Langley Date: Thu, 2 Apr 2026 09:58:08 -0700 Subject: [PATCH] chore: move csv_path_p, restructure modules --- src/import/csv_parser.rs | 5 +++++ src/main.rs | 9 +++------ src/model/mod.rs | 4 ++-- src/model/{model.rs => types.rs} | 0 src/view/mod.rs | 4 ++-- src/view/{view.rs => types.rs} | 0 6 files changed, 12 insertions(+), 10 deletions(-) rename src/model/{model.rs => types.rs} (100%) rename src/view/{view.rs => types.rs} (100%) diff --git a/src/import/csv_parser.rs b/src/import/csv_parser.rs index 2dd6f9f..4e85279 100644 --- a/src/import/csv_parser.rs +++ b/src/import/csv_parser.rs @@ -4,6 +4,11 @@ use anyhow::{Context, Result}; use csv::ReaderBuilder; use serde_json::Value; +pub fn csv_path_p(path: &Path) -> bool { + path.extension() + .is_some_and(|ext| ext.eq_ignore_ascii_case("csv")) +} + /// Parse a CSV file and return records as serde_json::Value array pub fn parse_csv(path: &Path) -> Result> { let mut reader = ReaderBuilder::new() diff --git a/src/main.rs b/src/main.rs index 1a538e1..ac3355d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,9 @@ mod persistence; mod ui; mod view; -use std::path::{Path, PathBuf}; +use crate::import::csv_parser::csv_path_p; + +use std::path::PathBuf; use anyhow::{Context, Result}; @@ -42,11 +44,6 @@ impl Runnable for CmdLineArgs { } } -fn csv_path_p(path: &Path) -> bool { - path.extension() - .is_some_and(|ext| ext.eq_ignore_ascii_case("csv")) -} - fn get_import_data(path: PathBuf) -> Option { match std::fs::read_to_string(&path) { Err(e) => { diff --git a/src/model/mod.rs b/src/model/mod.rs index 0c1ba71..8528f9a 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -1,5 +1,5 @@ pub mod category; pub mod cell; -pub mod model; +pub mod types; -pub use model::Model; +pub use types::Model; diff --git a/src/model/model.rs b/src/model/types.rs similarity index 100% rename from src/model/model.rs rename to src/model/types.rs diff --git a/src/view/mod.rs b/src/view/mod.rs index b2882d4..710c870 100644 --- a/src/view/mod.rs +++ b/src/view/mod.rs @@ -1,7 +1,7 @@ pub mod axis; pub mod layout; -pub mod view; +pub mod types; pub use axis::Axis; pub use layout::{AxisEntry, GridLayout}; -pub use view::View; +pub use types::View; diff --git a/src/view/view.rs b/src/view/types.rs similarity index 100% rename from src/view/view.rs rename to src/view/types.rs