waddling-sequences 0.1.0

Standard error sequence constants for consistent diagnostic codes across the Waddling ecosystem
Documentation
  • Coverage
  • 100%
    40 out of 40 items documented26 out of 27 items with examples
  • Size
  • Source code size: 103.12 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.22 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • AshutoshMahala

🦆 waddling-sequences

Standard error sequence definitions for the Waddling ecosystem

Crates.io Docs.rs License


What is this?

waddling-sequences provides standardized error sequence numbers with semantic meanings that are consistent across the entire Waddling ecosystem.

Think of it like HTTP status codes for errors:

  • Everyone knows 404 = Not Found
  • With Waddling: Everyone knows 001 = Missing, 002 = Mismatch, etc.

Features

  • Zero dependencies - Just pure constants
  • No-std compatible - Works everywhere
  • Tree-shakeable - Only imports what you use
  • Universal - Works with any error library
  • Well-documented - Every sequence has clear meaning

Quick Start

use waddling_sequences::core::*;

// Use standard sequences with semantic meaning
const MY_ERROR_CODE: u16 = MISSING;  // 001 - always means "missing"
const OTHER_ERROR: u16 = MISMATCH;   // 002 - always means "mismatch"

// Everyone in the ecosystem knows what these mean!

Sequence Categories

Core Errors (001-010)

use waddling_sequences::core::*;

MISSING       // 001 - Required item not found/provided
MISMATCH      // 002 - Values don't match expected
INVALID       // 003 - Format/validation failed
OVERFLOW      // 004 - Value too large
UNDERFLOW     // 005 - Value too small
OUTOFBOUNDS   // 006 - Index outside valid range
TIMEOUT       // 007 - Operation timed out
DENIED        // 008 - Permission denied
UNSUPPORTED   // 009 - Feature not supported
DEPRECATED    // 010 - Feature deprecated

State/Lifecycle (011-020)

use waddling_sequences::state::*;

UNINITIALIZED // 011 - Not initialized
ALREADYINIT   // 012 - Already initialized
CLOSED        // 013 - Resource closed
NOTREADY      // 014 - Not ready for operation
INPROGRESS    // 015 - Operation in progress
CANCELLED     // 016 - Operation cancelled

Resource Errors (021-030)

use waddling_sequences::resource::*;

NOTFOUND      // 021 - Resource not found
ALREADYEXISTS // 022 - Resource already exists
EXHAUSTED     // 023 - Resource exhausted
LOCKED        // 024 - Resource locked
CORRUPTED     // 025 - Data corrupted

Success (998-999)

use waddling_sequences::success::*;

PARTIAL       // 998 - Partial success
COMPLETE      // 999 - Full completion

With Metadata Feature

Enable the metadata feature to get documentation strings:

[dependencies]
waddling-sequences = { version = "0.1", features = ["metadata"] }
use waddling_sequences::metadata::DOCS;

// Get documentation for a sequence
let doc = DOCS.get(&001).unwrap();
println!("{}", doc); // "Required item not found/provided"

Project-Specific Sequences

Sequences 031-897 are unreserved - use them for domain-specific errors!

// Your custom sequences
const MY_CUSTOM_ERROR: u16 = 031;
const ANOTHER_ERROR: u16 = 050;

Usage with waddling-errors

use waddling_errors::ErrorCode;
use waddling_sequences::core::MISMATCH;

const TYPE_ERROR: ErrorCode = 
    ErrorCode::new("TYPES", "CHECK", MISMATCH);

Why Standard Sequences?

Before (Inconsistent)

// Project A
const ERR_MISSING: u16 = 001;  // "missing"
const ERR_NOTFOUND: u16 = 002; // "not found"

// Project B  
const ERR_NOTFOUND: u16 = 001; // "not found"
const ERR_MISSING: u16 = 005;  // "missing"

❌ Same concept, different numbers across projects!

After (Consistent)

// Project A
use waddling_sequences::core::MISSING;  // 001

// Project B
use waddling_sequences::core::MISSING;  // 001

✅ Same number, same meaning, everywhere!

Convention Document

See SEQUENCE-CONVENTIONS.md for full details on the standardized sequences.

No-std Support

Works in no-std environments:

#![no_std]
use waddling_sequences::core::*;

License

Licensed under either of:

at your option.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md.


Made with 🦆 by the Waddling team