Files
brk/parser/src/structs/any_map.rs
2024-10-28 16:48:27 +01:00

33 lines
707 B
Rust

use std::path::{Path, PathBuf};
use serde_json::Value;
use super::MapKind;
pub trait AnyMap {
fn path(&self) -> &Path;
fn path_last(&self) -> &Option<PathBuf>;
fn last_value(&self) -> Option<Value>;
fn t_name(&self) -> &str;
fn exported_path_with_t_name(&self) -> Vec<(&Path, &str)> {
let t_name = self.t_name();
if let Some(path_last) = self.path_last() {
vec![(self.path(), t_name), (path_last, t_name)]
} else {
vec![(self.path(), t_name)]
}
}
fn pre_export(&mut self);
fn export(&self) -> color_eyre::Result<()>;
fn post_export(&mut self);
fn delete_files(&self);
fn kind(&self) -> MapKind;
}