diff options
Diffstat (limited to 'src/statistics')
-rw-r--r-- | src/statistics/math.rs | 8 | ||||
-rw-r--r-- | src/statistics/mod.rs | 15 |
2 files changed, 12 insertions, 11 deletions
diff --git a/src/statistics/math.rs b/src/statistics/math.rs index b7dd6ac..a0849a3 100644 --- a/src/statistics/math.rs +++ b/src/statistics/math.rs @@ -25,7 +25,8 @@ pub trait Monoid: Semigroup { } #[derive(Debug, Clone)] -struct Record<X, T, D> { +#[doc(hidden)] +pub struct Record<X, T, D> { x: X, tag: T, data: D, @@ -63,6 +64,11 @@ where RecordFunc { data: Vec::new() } } + #[doc(hidden)] + pub fn data(&self) -> &[Record<X, T, D>] { + &self.data + } + /// Insert a data point into the record func. /// /// Note that you should supply the *increment*, not the *absolute value*! diff --git a/src/statistics/mod.rs b/src/statistics/mod.rs index eccc3ee..3e42d9c 100644 --- a/src/statistics/mod.rs +++ b/src/statistics/mod.rs @@ -1,7 +1,7 @@ //! This module aids in the creation of actual boss statistics. use super::*; use std::collections::HashMap; -use std::error::Error; +use thiserror::Error; pub mod boon; pub mod damage; @@ -17,15 +17,10 @@ use self::trackers::{RunnableTracker, Tracker}; pub type StatResult<T> = Result<T, StatError>; -quick_error! { - #[derive(Debug)] - pub enum StatError { - TrackerError(err: Box<dyn Error>) { - description("tracker error") - display("tracker returned an error: {}", err) - cause(&**err) - } - } +#[derive(Error, Debug)] +pub enum StatError { + #[error("tracker returned an error: {0}")] + TrackerError(#[from] Box<dyn std::error::Error>), } macro_rules! try_tracker { |