use waddling_errors::{Code, ComponentId, PrimaryId, error};
#[derive(Debug, Copy, Clone)]
enum Component {
Auth,
}
impl ComponentId for Component {
fn as_str(&self) -> &'static str {
"AUTH"
}
}
#[derive(Debug, Copy, Clone)]
enum Primary {
Token,
}
impl PrimaryId for Primary {
fn as_str(&self) -> &'static str {
"TOKEN"
}
}
const ERR_TOKEN_MISSING: Code<Component, Primary> = error(Component::Auth, Primary::Token, 1);
#[cfg(target_arch = "wasm32")]
#[unsafe(no_mangle)]
pub extern "C" fn get_severity_char() -> u8 {
ERR_TOKEN_MISSING.severity().as_char() as u8
}
fn main() {
println!("Error code: {}", ERR_TOKEN_MISSING.code());
println!("Severity: {}", ERR_TOKEN_MISSING.severity().as_char());
println!("\nThis is a minimal example for WASM size testing.");
println!("To build for WASM:");
println!(
" cargo build --example wasm_minimal --target wasm32-unknown-unknown --release --no-default-features"
);
}