mod ggplot;
mod history;
mod html;
pub mod reference;
mod server;
pub use ggplot::{aes, ggplot, Aes, Field, Plot, PlotData, Value};
pub use history::{sample_indices, Frame, RunEvent, RunHistory, RunMeta, RunView, Timing, VariableType, RUN_FORMAT, RUN_VERSION};
pub use html::{open_in_browser, standalone_html};
pub use server::{ColumnFn, Columns, Dashboard, FocusRequest, RunState};
use std::fmt;
#[derive(Debug)]
pub enum PlotError {
UnknownField(String),
InvalidLayer(String),
InvalidRun(String),
Io(std::io::Error),
Json(serde_json::Error),
}
impl fmt::Display for PlotError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
PlotError::UnknownField(m) => write!(f, "unknown field: {m}"),
PlotError::InvalidLayer(m) => write!(f, "invalid layer: {m}"),
PlotError::InvalidRun(m) => write!(f, "invalid run file: {m}"),
PlotError::Io(e) => write!(f, "{e}"),
PlotError::Json(e) => write!(f, "{e}"),
}
}
}
impl std::error::Error for PlotError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
PlotError::Io(e) => Some(e),
PlotError::Json(e) => Some(e),
_ => None,
}
}
}
impl From<std::io::Error> for PlotError {
fn from(e: std::io::Error) -> Self {
PlotError::Io(e)
}
}
impl From<serde_json::Error> for PlotError {
fn from(e: serde_json::Error) -> Self {
PlotError::Json(e)
}
}