Files
dvd-thing/architecture.mmd
Gabriel Kaszewski 15fdace324
All checks were successful
CI / Check / Test (push) Successful in 3m40s
init v.1.0.0
Co-authored-by: Copilot <copilot@github.com>
2026-08-06 20:11:22 +02:00

94 lines
3.4 KiB
Plaintext

%% dvd-thing — ports and adapters.
%% Every dependency arrow points inward. domain knows nothing; application knows
%% only domain; adapters know both but are known by neither.
flowchart TB
subgraph root["bin — composition root"]
main["main.rs<br/><i>the only place that names Wayland</i>"]
end
subgraph adapters["adapters — std"]
direction LR
subgraph wayland["wayland"]
display["WaylandDisplay<br/><i>layer-shell surface, frame pacing, signals</i>"]
renderer["SoftwareRenderer<br/><i>double-buffered shm, damage tracking</i>"]
logoimage["LogoImage<br/><i>decode, scale, tint cache</i>"]
state["WaylandState<br/><i>protocol dispatch</i>"]
end
subgraph assets["assets"]
filesource["FileLogoSource<br/><i>$DVD_LOGO, XDG / macOS / Windows</i>"]
end
end
subgraph app["application — no_std, no alloc"]
direction LR
subgraph portsgroup["ports"]
displayport["DisplayOverlayPort<br/><i>screen_dimensions, wait_for_frame</i>"]
rendererport["RendererPort<br/><i>render_frame</i>"]
logoport["LogoSourcePort<br/><i>load</i>"]
end
usecases["use_cases<br/><b>run</b> · blocking loop<br/><b>step</b> · one frame, for callback platforms"]
apperror["ApplicationError<br/><i>heapless Message, 108 bytes</i>"]
end
subgraph dom["domain — no_std, no alloc"]
direction LR
scene["ScreensaverScene<br/><b>aggregate root</b><br/><i>sole entry point: tick, sprites</i>"]
logo["BouncingLogo<br/><i>pub(crate)</i>"]
sparkle["Sparkle<br/><i>pub(crate)</i>"]
sprite["Sprite + SpriteKind<br/><i>what to draw, not how</i>"]
vo["Value objects<br/>Point2D · Vector2D<br/>Dimensions · Color<br/><i>self-validating, const fn</i>"]
domerror["DomainError<br/><i>InvalidDimensions</i>"]
end
main --> usecases
main --> scene
main -.->|constructs| display
main -.->|constructs| renderer
main -.->|constructs| filesource
usecases --> displayport
usecases --> rendererport
usecases --> scene
display -.->|implements| displayport
renderer -.->|implements| rendererport
filesource -.->|implements| logoport
renderer -->|"sprites()"| scene
renderer --> logoimage
logoimage -->|"load()"| logoport
renderer --> display
display --> state
scene -->|owns| logo
scene -->|"owns [Option Sparkle; 108]"| sparkle
logo --> sprite
sparkle --> sprite
sprite --> vo
scene --> vo
scene -.->|"new() rejects"| domerror
apperror -.->|wraps| domerror
classDef domainStyle fill:#1f4e3d,stroke:#41b883,color:#e8f5ee
classDef appStyle fill:#1e3a5f,stroke:#4a9eff,color:#e6f0ff
classDef adapterStyle fill:#4a3410,stroke:#d99a2b,color:#fdf3e0
classDef rootStyle fill:#3d2645,stroke:#b06fc9,color:#f6ecfa
style root fill:#88888810,stroke:#9a9a9a
style adapters fill:#88888810,stroke:#9a9a9a
style wayland fill:#88888810,stroke:#9a9a9a
style assets fill:#88888810,stroke:#9a9a9a
style app fill:#88888810,stroke:#9a9a9a
style portsgroup fill:#88888810,stroke:#9a9a9a
style dom fill:#88888810,stroke:#9a9a9a
class scene,logo,sparkle,sprite,vo,domerror domainStyle
class displayport,rendererport,logoport,usecases,apperror appStyle
class display,renderer,logoimage,state,filesource adapterStyle
class main rootStyle