Function error_instance_count

Source
pub fn error_instance_count() -> u32
Expand description

Gets the current number of Yoshi error instances created.

This function provides a way to inspect the cumulative count of Yoshi error objects instantiated. It can be useful for profiling, detecting excessive error creation, or understanding error patterns in an application.

§Returns

The total number of Yoshi error instances created as a u64.

§Examples

use yoshi_std::{Yoshi, YoshiKind, error_instance_count};

let initial_count = error_instance_count();
let _err1 = Yoshi::new(YoshiKind::Internal {
    message: "simulated error 1".into(),
    source: None,
    component: None,
});
let _err2 = Yoshi::new(YoshiKind::Internal {
    message: "simulated error 2".into(),
    source: None,
    component: None,
});

assert_eq!(error_instance_count(), initial_count + 2);