4 releases

0.0.4 Oct 8, 2024
0.0.3 Oct 8, 2024
0.0.2 Sep 22, 2024
0.0.1 Sep 22, 2024

#860 in Rust patterns

Download history 355/week @ 2024-09-22 64/week @ 2024-09-29 283/week @ 2024-10-06 98/week @ 2024-10-13 100/week @ 2024-10-20 33/week @ 2024-10-27 31/week @ 2024-11-03 2/week @ 2024-11-10 17/week @ 2024-11-17 31/week @ 2024-11-24 27/week @ 2024-12-01 49/week @ 2024-12-08 21/week @ 2024-12-15

73 downloads per month
Used in 15 crates (9 directly)

MIT license

4KB

🚀 err-rs: Error Level Management

Welcome to err-rs! This library provides a simple and efficient way to categorize and handle different levels of errors in your applications.

🛠ī¸ Features

  • Error Levels: Define and categorize error severity with the ErrorLevel enum.
  • Trait for Error Level Providers: Implement the ErrorLevelProvider trait to easily retrieve error levels.
  • Utility Function: Use most_severe_error to determine the highest severity from a slice of error levels.

đŸ“Ļ Error Levels

The ErrorLevel enum provides three levels of error severity:

#[derive(Copy, Clone, Eq, PartialEq, Debug, Ord, PartialOrd)]
pub enum ErrorLevel {
    Info,     // ℹī¸ Informative, can be ignored
    Warning,  // ⚠ī¸ Should be logged, but recoverable
    Critical, // ❗ Requires immediate attention, unrecoverable
}

💡 Usage

To use the library, implement the ErrorLevelProvider trait in your structs or enums:

pub trait ErrorLevelProvider {
    fn error_level(&self) -> ErrorLevel;
}

🚀 Getting Started

To include err-rs in your project, add the following to your Cargo.toml:

[dependencies]
err-rs = "0.0.3"

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

No runtime deps