devela/code/result/error/
ext.rs

1// devela::code::result::error::ext
2//
3//! Defines the `ExtError` trait.
4//
5
6use crate::Error;
7
8/// Extension trait providing additional methods for `T:`[`Error`].
9// #[cfg_attr(feature = "nightly_doc", doc(notable_trait))]
10pub trait ExtError: Error {
11    /// Represents the specific kind of error, if applicable.
12    ///
13    /// Types implementing this trait may use `Kind` to categorize
14    /// errors into meaningful groups for comparison or analysis.
15    // WAIT: [associated_type_defaults](https://github.com/rust-lang/rust/issues/29661)
16    type Kind; // = ()
17
18    /// Checks if two errors are equivalent based on their kind or other criteria.
19    #[must_use]
20    fn error_eq(&self, other: &Self) -> bool;
21
22    /// Returns the kind of the error, if applicable.
23    #[must_use]
24    fn error_kind(&self) -> Self::Kind; // {}
25}