Skip to main content

oxilean_runtime/eval_error/
collectingpanichandler_traits.rs

1//! # CollectingPanicHandler - Trait Implementations
2//!
3//! This module contains trait implementations for `CollectingPanicHandler`.
4//!
5//! ## Implemented Traits
6//!
7//! - `Default`
8//! - `PanicHandler`
9//!
10//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
11
12use super::functions::PanicHandler;
13use super::types::{CollectingPanicHandler, EvalError};
14
15impl Default for CollectingPanicHandler {
16    fn default() -> Self {
17        Self::new()
18    }
19}
20
21impl PanicHandler for CollectingPanicHandler {
22    fn on_panic(&self, err: &EvalError) {
23        self.panics
24            .lock()
25            .unwrap_or_else(|e| e.into_inner())
26            .push(err.to_string());
27    }
28}