use std::path::Path;
use openreadout_core::model::FileInfo;
use openreadout_core::{Dataset, Registry, Result};
use crate::table::{ColumnDoc, Row};
pub struct Item<'a> {
pub path: &'a Path,
pub registry: &'a Registry,
pub dataset: &'a mut dyn Dataset,
pub info: &'a FileInfo,
}
impl std::fmt::Debug for Item<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Item")
.field("path", &self.path)
.field("format", &self.info.format.id)
.finish_non_exhaustive()
}
}
pub trait Measure: Send + Sync {
fn id(&self) -> &'static str;
fn grain(&self) -> Vec<String>;
fn columns(&self) -> Vec<ColumnDoc> {
Vec::new()
}
fn headers_only(&self) -> bool {
false
}
fn fingerprint(&self) -> String;
fn rows(&self, item: &mut Item<'_>) -> Result<Vec<Row>>;
}