# shm11c3/adl-rs architecture

> Architecture diagram of the GitHub repository shm11c3/adl-rs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shm11c3/adl-rs
- Repository: https://github.com/shm11c3/adl-rs

## Overview

##### Project type and purpose
- This is a multi-crate Rust library (“adl-rs”) exposing bindings for the AMD Display Library (ADL) SDK.
- It consists of:
- a low-level FFI crate (`adl-sys`) that wraps the C headers,
- a high-level ergonomic crate (`adl`) built on top of `adl-sys`,
- and an example binary (`adl-example`) that demonstrates usage.

##### File structure
- Top-level crates in the workspace:
- `adl-sys/` – raw bindings, `build.rs`, `include/*.h`.
- `adl/` – safe wrapper, divided into `adapter/`, `context/`, `overdrive/`, `performance/`.
- `adl-example/` – binary demonstrating the API.
- Root `Cargo.toml` and `Cargo.lock` define the workspace.
- CI workflows (`.github/workflows`) run build and lint checks.
- `.vscode`, `rustfmt.toml` handle local configuration.

##### README for additional insights
- Confirms that `adl-sys` is the FFI layer and `adl` is the ergonomic layer.
- Shows build and run commands.

##### Elements
- adl-example
- adl (with sub-modules)
- adl-sys
- ADL SDK (native)
- function calls (example → adl → adl-sys → SDK)
- build/link steps (`build.rs` → SDK)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Workspace"
        direction TB

        subgraph "Crates"
            direction TB
            adlExample["adl-example (binary)"]:::crate
            adlCrate["adl (safe API crate)"]:::crate
            adlSys["adl-sys (FFI crate)"]:::crate
            adlSdk["ADL SDK (native C library)"]:::native
        end

        subgraph "adl (safe API crate)"
            direction TB
            adapter["adapter"]:::module
            context["context"]:::module
            overdrive["overdrive"]:::module
            performance["performance"]:::module
        end

        subgraph "adl-sys (FFI crate)"
            direction TB
            buildRs["build.rs"]:::crate
            adlSysLib["lib.rs"]:::crate
            subgraph "Includes"
                direction TB
                h1["adl_defines.h"]:::native
                h2["adl_sdk.h"]:::native
                h3["adl_structures.h"]:::native
                h4["stdbool_shim.h"]:::native
                h5["wchar_shim.h"]:::native
            end
        end

        subgraph "CI & Config"
            direction TB
            ci["ci.yml"]:::config
            clippy["rust-clippy.yml"]:::config
            vscode[".vscode/"]:::config
            rustfmt["rustfmt.toml"]:::config
        end
    end

    adlExample -->|"Rust API call"| adlCrate
    adlCrate -->|"calls FFI boundary"| adlSys
    adlSys -->|"FFI call"| adlSdk
    buildRs -->|"build/link"| adlSdk

    classDef crate fill:#b3cde0,stroke:#333,stroke-width:1px
    classDef native fill:#fbb4ae,stroke:#333,stroke-width:1px
    classDef module fill:#ccebc5,stroke:#333,stroke-width:1px
    classDef config fill:#decbe4,stroke:#333,stroke-width:1px

    click adlExample "https://github.com/shm11c3/adl-rs/blob/master/adl-example/src/main.rs"
    click adlCrate "https://github.com/shm11c3/adl-rs/blob/master/adl/Cargo.toml"
    click adapter "https://github.com/shm11c3/adl-rs/tree/master/adl/src/adapter/"
    click context "https://github.com/shm11c3/adl-rs/blob/master/adl/src/context/mod.rs"
    click overdrive "https://github.com/shm11c3/adl-rs/blob/master/adl/src/overdrive/mod.rs"
    click performance "https://github.com/shm11c3/adl-rs/blob/master/adl/src/performance/mod.rs"
    click adlSys "https://github.com/shm11c3/adl-rs/blob/master/adl-sys/Cargo.toml"
    click buildRs "https://github.com/shm11c3/adl-rs/blob/master/adl-sys/build.rs"
    click adlSysLib "https://github.com/shm11c3/adl-rs/blob/master/adl-sys/src/lib.rs"
    click h1 "https://github.com/shm11c3/adl-rs/blob/master/adl-sys/include/adl_defines.h"
    click h2 "https://github.com/shm11c3/adl-rs/blob/master/adl-sys/include/adl_sdk.h"
    click h3 "https://github.com/shm11c3/adl-rs/blob/master/adl-sys/include/adl_structures.h"
    click h4 "https://github.com/shm11c3/adl-rs/blob/master/adl-sys/include/stdbool_shim.h"
    click h5 "https://github.com/shm11c3/adl-rs/blob/master/adl-sys/include/wchar_shim.h"
    click ci "https://github.com/shm11c3/adl-rs/blob/master/.github/workflows/ci.yml"
    click clippy "https://github.com/shm11c3/adl-rs/blob/master/.github/workflows/rust-clippy.yml"
    click vscode "https://github.com/shm11c3/adl-rs/tree/master/.vscode/"
    click rustfmt "https://github.com/shm11c3/adl-rs/blob/master/rustfmt.toml"
```
