devela/code/result/error/
ext.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// devela::code::result::error::ext
//
//! Defines the `ExtError` trait.
//

use crate::Error;

/// Extension trait providing additional methods for `T:`[`Error`].
// #[cfg_attr(feature = "nightly_doc", doc(notable_trait))]
pub trait ExtError: Error {
    /// Represents the specific kind of error, if applicable.
    ///
    /// Types implementing this trait may use `Kind` to categorize
    /// errors into meaningful groups for comparison or analysis.
    // WAIT: [associated_type_defaults](https://github.com/rust-lang/rust/issues/29661)
    type Kind; // = ()

    /// Checks if two errors are equivalent based on their kind or other criteria.
    #[must_use]
    fn error_eq(&self, other: &Self) -> bool;

    /// Returns the kind of the error, if applicable.
    #[must_use]
    fn error_kind(&self) -> Self::Kind; // {}
}