Expand description
§Adapters — External System Integration
Adapters implement the port traits to connect the domain to external systems.
§Overview
PORTS ADAPTERS
┌──────────────┐ ┌─────────────────────┐
│ ConfigPort │◄─────────────│ TomlConfigAdapter │
└──────────────┘ │ JsonConfigAdapter │
└─────────────────────┘
┌──────────────┐ ┌─────────────────────┐
│ PersistPort │◄─────────────│ FileSystemAdapter │
└──────────────┘ └─────────────────────┘
┌──────────────┐ ┌─────────────────────┐
│ NotifyPort │◄─────────────│ DbusNotifyAdapter │
└──────────────┘ └─────────────────────┘
┌──────────────┐ ┌─────────────────────┐
│ IpcPort │◄─────────────│ DbusIpcAdapter │
└──────────────┘ └─────────────────────┘§Available Adapters
| Adapter | Port | Description |
|---|---|---|
TomlConfigAdapter | ConfigPort | Load config from TOML files |
JsonConfigAdapter | ConfigPort | Load config from JSON files |
FileSystemAdapter | PersistPort | Save themes to filesystem |
DbusNotifyAdapter | NotifyPort | Send notifications via D-Bus |
DbusIpcAdapter | IpcPort | Communicate with QuickShell via D-Bus |
§Feature Flags
Some adapters are behind feature flags:
dbus— EnablesDbusNotifyAdapterandDbusIpcAdapterwatch— Enables file watching capabilities
§Example
ⓘ
use fernctl::adapters::{TomlConfigAdapter, FileSystemAdapter};
use fernctl::ports::inbound::ConfigPort;
use fernctl::ports::outbound::PersistPort;
// Load configuration
let config_adapter = TomlConfigAdapter::new();
let raw = config_adapter.load_from_file("config.toml")?;
let theme = raw.validate()?.into_theme();
// Save as JSON for QuickShell
let persist_adapter = FileSystemAdapter::new();
persist_adapter.save_theme(&theme, "config.json")?;Structs§
- File
System Adapter - Adapter for persisting themes to the filesystem.
- Json
Config Adapter - Adapter for loading configuration from JSON files.
- Toml
Config Adapter - Adapter for loading configuration from TOML files.
Functions§
- toml_
to_ 🔒json - Converts a TOML value to a JSON value.