๐Ÿฆ†
BetaRust Implementation

The WDP Reference
Implementation

The reference Rust library for the Waddling Diagnostic Protocol. Zero runtime dependencies, compile-time validation, and automated catalog generation.

v0.7
Version
no_std
Compatible
0
Runtime Deps
Type
Safe

๐Ÿ“‹ Overview

Structured diagnostic codes with a consistent 4-part format

Error Code Format

[SEVERITY.COMPONENT.PRIMARY.SEQUENCE] โ†’ HASH
SEVERITYSingle character: E, W, C, etc.COMPONENTNamespace or modulePRIMARYCategory or domainSEQUENCE3-digit semantic IDHASH5-char compact ID (Base62)

Examples

// Error in Auth
[E.AUTH.TOKEN.001] โ†’ aB3xY
// Warning in Parser
[W.PARSER.SYNTAX.003] โ†’ cD5zA
// Success in Build
[S.BUILD.DONE.999] โ†’ eF7gH

โœจ Key Features

Everything you need for robust error handling

Type-safe

Define your own enums with compile-time checking

Zero Runtime Deps

Macros run at compile time. No bloat.

no_std

Works in embedded and WASM environments

Documentation

Auto-generate JSON & HTML docs

Semantic Methods

is_blocking(), is_positive(), priority()

Validation

Catch invalid sequences at compile time

Hashes

5-character base62 hashes for compact logs

Customizable

Define your own strictness rules

๐ŸŽฏ Severity Levels

Nine severity levels with semantic methods

SeverityCodeEmojiPriorityBlockingUse Case
ErrorEโŒ8YesInvalid input, logic errors
BlockedB๐Ÿšซ7YesDeadlock, I/O wait
CriticalC๐Ÿ”ฅ6NoData corruption
WarningWโš ๏ธ5NoDeprecated API
HelpH๐Ÿ’ก4NoSuggestions
SuccessSโœ…3NoOperation succeeded
CompletedKโœ”๏ธ2NoTask finished
InfoIโ„น๏ธ1NoEvents, status
TraceT๐Ÿ”0NoDebug traces

๐Ÿ”ข Sequence Conventions

Semantic sequence numbers for consistency across projects

001-010

Input/Data

Missing params, type mismatches

011-020

State/Lifecycle

Uninitialized, closed, cancelled

021-030

Resource/Storage

Not found, already exists, locked

031-897

Project-specific

Domain-specific errors

998-999

Success/Done

Completion indicators

๐Ÿš€ Quick Start

Get started in minutes

Step 1: Add Dependency

[dependencies]
waddling-errors = "0.7"

Step 2: Define & Use

use waddling_errors_macros::{component, primary, sequence, diag, setup};

// 1. Setup macro paths (at crate root, before diag!)
setup! {
    components = crate,
    primaries = crate,
    sequences = crate,
}

// 2. Define Architecture
component! { Auth { docs: "Authentication" } }
primary! { Token { docs: "Token errors" } }

// 3. Define Events
sequence! {
    MISSING(1) { description: "Required item missing" }
}

// 4. Create Diagnostics
diag! {
    E.Auth.Token.MISSING: {
        message: "JWT token not found in Authorization header",
        hints: ["Include 'Authorization: Bearer <token>' header"],
    }
}

fn main() {
    println!("Code: {}", E_AUTH_TOKEN_MISSING.runtime.code);  // "E.Auth.Token.001"
    println!("Hash: {}", E_AUTH_TOKEN_MISSING.hash);          // "Xy8Qz"
}
Theme Color
๐ŸŒˆ Auto Cycle
HUE: 239.0
CYCLING: ON