# shurankain/bbse architecture

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

- Interactive diagram: https://gitdiagram.com/shurankain/bbse
- Repository: https://github.com/shurankain/bbse

## Overview

BBSE is a small Rust library for encoding integers in a known range as binary-search paths and decoding those paths back into values. Its principal workflow is encode, retain or pass the path, then decode with the same range. Optional custom-midpoint functions support biased splits; BBSEStack stores multiple paths and decodes them together. The relationships shown are documented in the README or visible in src/lib.rs.

Main entry points: [`src/lib.rs`](https://github.com/shurankain/bbse/blob/main/src/lib.rs) (BBSEStack)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("Library user"))
node_encode["Encode path<br/>[lib.rs]"]
node_decode["Decode value<br/>[lib.rs]"]
node_encode_custom["Custom encode<br/>[lib.rs]"]
node_decode_custom["Custom decode<br/>[lib.rs]"]
node_stack["BBSEStack<br/>[lib.rs]"]

node_user -->|"encodes value"| node_encode
node_encode -->|"returns path"| node_user
node_user -->|"supplies path"| node_decode
node_decode -->|"returns value"| node_user
node_user -->|"chooses midpoint"| node_encode_custom
node_encode_custom -->|"returns path"| node_user
node_user -->|"supplies path"| node_decode_custom
node_decode_custom -->|"returns value"| node_user
node_user -->|"uses stack"| node_stack
node_encode -->|"pushes paths"| node_stack
node_stack -->|"decodes all"| node_user
node_stack -->|"calls decoder"| node_decode

click node_encode "https://github.com/shurankain/bbse/blob/main/src/lib.rs"
click node_decode "https://github.com/shurankain/bbse/blob/main/src/lib.rs"
click node_encode_custom "https://github.com/shurankain/bbse/blob/main/src/lib.rs"
click node_decode_custom "https://github.com/shurankain/bbse/blob/main/src/lib.rs"
click node_stack "https://github.com/shurankain/bbse/blob/main/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_user toneBlue
class node_encode,node_decode,node_encode_custom,node_decode_custom,node_stack toneTeal
```

## Components

### Other components

- **Library user**
- [Encode path](https://github.com/shurankain/bbse/blob/main/src/lib.rs): `src/lib.rs`
- [Decode value](https://github.com/shurankain/bbse/blob/main/src/lib.rs): `src/lib.rs`
- [Custom encode](https://github.com/shurankain/bbse/blob/main/src/lib.rs): `src/lib.rs`
- [Custom decode](https://github.com/shurankain/bbse/blob/main/src/lib.rs): `src/lib.rs`
- [BBSEStack](https://github.com/shurankain/bbse/blob/main/src/lib.rs): `src/lib.rs`

## Connections

- Library user → Encode path: encodes value (evidence: `README.md`)
- Encode path → Library user: returns path (evidence: `src/lib.rs`)
- Library user → Decode value: supplies path (evidence: `README.md`)
- Decode value → Library user: returns value (evidence: `src/lib.rs`)
- Library user → Custom encode: chooses midpoint (evidence: `README.md`)
- Custom encode → Library user: returns path (evidence: `src/lib.rs`)
- Library user → Custom decode: supplies path (evidence: `README.md`)
- Custom decode → Library user: returns value (evidence: `src/lib.rs`)
- Library user → BBSEStack: uses stack (evidence: `README.md`)
- Encode path → BBSEStack: pushes paths (evidence: `README.md`)
- BBSEStack → Library user: decodes all (evidence: `README.md`)
- BBSEStack → Decode value: calls decoder (evidence: `src/lib.rs`)
