Expand description
Commonly used types and functions
use waddling_errors::prelude::*;
#[derive(Debug, Copy, Clone)]
enum MyComponent { Auth, Database }
impl ComponentId for MyComponent {
fn as_str(&self) -> &'static str {
match self { MyComponent::Auth => "AUTH", MyComponent::Database => "DATABASE" }
}
}
#[derive(Debug, Copy, Clone)]
enum MyPrimary { Token, Connection }
impl PrimaryId for MyPrimary {
fn as_str(&self) -> &'static str {
match self { MyPrimary::Token => "TOKEN", MyPrimary::Connection => "CONN" }
}
}
const ERR: Code<MyComponent, MyPrimary> = error(MyComponent::Auth, MyPrimary::Token, 1);Prelude module for convenient imports