# saltyfishie98/my-error-rs architecture

> Architecture diagram of the GitHub repository saltyfishie98/my-error-rs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saltyfishie98/my-error-rs
- Repository: https://github.com/saltyfishie98/my-error-rs

## Overview

This small Rust library provides stacked-error formatting through a runtime trait and an attribute procedural macro. A consumer annotates an error enum; the macro generates the trait implementation and a Debug formatter. Runtime helpers then render the internal error chain as full debug output, collect source locations, or produce a terse user-facing message. The README is empty, so the usage flow is based on the source example and implementation; no broader integrations are evidenced.

Main entry points: [`src/lib.rs`](https://github.com/saltyfishie98/my-error-rs/blob/master/src/lib.rs) (StackError trait), [`stack_trace_debug/src/lib.rs`](https://github.com/saltyfishie98/my-error-rs/blob/master/stack_trace_debug/src/lib.rs) (Stack trace macro)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_consumer(("Library consumer"))
node_attribute_macro["Stack trace macro<br/>[lib.rs]"]
node_stack_error_trait["StackError trait<br/>[lib.rs]"]
node_debug_formatter["Debug formatting<br/>[lib.rs]"]
node_full_stack["Full stack output<br/>[lib.rs]"]
node_location_collection["Location collection<br/>[lib.rs]"]
node_user_format["User-facing output<br/>[lib.rs]"]

node_consumer -->|"annotates enum"| node_attribute_macro
node_attribute_macro -->|"generates implementation"| node_stack_error_trait
node_attribute_macro -->|"generates Debug"| node_debug_formatter
node_full_stack -->|"calls debug_fmt"| node_stack_error_trait
node_location_collection -->|"walks chain"| node_stack_error_trait
node_user_format -->|"walks chain"| node_stack_error_trait

click node_attribute_macro "https://github.com/saltyfishie98/my-error-rs/blob/master/stack_trace_debug/src/lib.rs"
click node_stack_error_trait "https://github.com/saltyfishie98/my-error-rs/blob/master/src/lib.rs"
click node_debug_formatter "https://github.com/saltyfishie98/my-error-rs/blob/master/stack_trace_debug/src/lib.rs"
click node_full_stack "https://github.com/saltyfishie98/my-error-rs/blob/master/src/lib.rs"
click node_location_collection "https://github.com/saltyfishie98/my-error-rs/blob/master/src/lib.rs"
click node_user_format "https://github.com/saltyfishie98/my-error-rs/blob/master/src/lib.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_consumer toneIndigo
class node_attribute_macro,node_stack_error_trait,node_debug_formatter,node_full_stack,node_location_collection toneTeal
class node_user_format toneBlue
```

## Components

### Other components

- **Library consumer**
- [Stack trace macro](https://github.com/saltyfishie98/my-error-rs/blob/master/stack_trace_debug/src/lib.rs): `stack_trace_debug/src/lib.rs`
- [StackError trait](https://github.com/saltyfishie98/my-error-rs/blob/master/src/lib.rs): `src/lib.rs`
- [Debug formatting](https://github.com/saltyfishie98/my-error-rs/blob/master/stack_trace_debug/src/lib.rs): `stack_trace_debug/src/lib.rs`
- [Full stack output](https://github.com/saltyfishie98/my-error-rs/blob/master/src/lib.rs): `src/lib.rs`
- [Location collection](https://github.com/saltyfishie98/my-error-rs/blob/master/src/lib.rs): `src/lib.rs`
- [User-facing output](https://github.com/saltyfishie98/my-error-rs/blob/master/src/lib.rs): `src/lib.rs`

## Connections

- Library consumer → Stack trace macro: annotates enum (evidence: `stack_trace_debug/src/lib.rs`)
- Stack trace macro → StackError trait: generates implementation (evidence: `stack_trace_debug/src/lib.rs`)
- Stack trace macro → Debug formatting: generates Debug (evidence: `stack_trace_debug/src/lib.rs`)
- Full stack output → StackError trait: calls debug_fmt (evidence: `src/lib.rs`)
- Location collection → StackError trait: walks chain (evidence: `src/lib.rs`)
- User-facing output → StackError trait: walks chain (evidence: `src/lib.rs`)
