perf_plotter/
error.rs

1// SPDX-License-Identifier: Apache-2.0
2
3#[derive(Debug, Clone, PartialEq, Eq)]
4pub struct PerfPlotterError {
5    pub msg: String,
6}
7
8impl std::fmt::Display for PerfPlotterError {
9    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10        write!(f, "{}", &self.msg)
11    }
12}
13
14impl std::error::Error for PerfPlotterError {}
15
16impl PerfPlotterError {
17    pub fn new(msg: String) -> Self {
18        Self { msg }
19    }
20}
21
22impl From<&str> for PerfPlotterError {
23    fn from(msg: &str) -> Self {
24        Self::new(msg.to_string())
25    }
26}