Skip to main content

mint_core/data/
mod.rs

1pub mod error;
2mod excel;
3mod helpers;
4mod json;
5
6use crate::layout::value::{DataValue, ValueSource};
7use error::DataError;
8pub use excel::{ExcelDataSource, ExcelDataSourceOptions};
9pub use json::JsonDataSource;
10
11/// Trait for data sources that provide values by name.
12pub trait DataSource: Sync {
13    /// Retrieves a single numeric or boolean value.
14    fn retrieve_single_value(&self, name: &str) -> Result<DataValue, DataError>;
15
16    /// Retrieves a 1D array (from sheet reference) or a literal string.
17    fn retrieve_1d_array_or_string(&self, name: &str) -> Result<ValueSource, DataError>;
18
19    /// Retrieves a 2D array from a sheet reference.
20    fn retrieve_2d_array(&self, name: &str) -> Result<Vec<Vec<DataValue>>, DataError>;
21}