pub struct ApplicationBuilder { /* private fields */ }Expand description
Assembles an Application from ports and modules.
Clock and event bus have exactly one sensible default and are pre-filled. Storage,
credentials and notifications must be chosen explicitly — or taken from
ApplicationBuilder::in_memory for tests.
Implementations§
Source§impl ApplicationBuilder
impl ApplicationBuilder
pub fn new() -> Self
Sourcepub fn in_memory() -> Self
pub fn in_memory() -> Self
A fully in-memory application: no files, no keychain, no notifications.
This is the configuration from ADR-0002 — it makes the whole application testable without starting a desktop session.
pub fn clock(self, clock: Arc<dyn Clock>) -> Self
Sourcepub fn event_bus(self, events: EventBus) -> Self
pub fn event_bus(self, events: EventBus) -> Self
Share an existing bus, e.g. one the host layer already subscribed to.
pub fn storage(self, storage: Arc<dyn Storage>) -> Self
pub fn secret_store(self, secrets: Arc<dyn SecretStore>) -> Self
pub fn notifications(self, notifications: Arc<dyn NotificationService>) -> Self
Sourcepub fn opener(self, opener: Arc<dyn Opener>) -> Self
pub fn opener(self, opener: Arc<dyn Opener>) -> Self
Grant the ability to open external URLs. Omitted means the product does not have the capability at all, not that it is disabled at runtime.
Sourcepub fn confirmation(self, confirmation: Arc<dyn ConfirmationService>) -> Self
pub fn confirmation(self, confirmation: Arc<dyn ConfirmationService>) -> Self
Override the human confirmation service. The default denies everything, so a product that grants MCP mutation must call this — the error message in the MCP tool response tells the product author why.
Sourcepub fn tray(self, tray: Arc<dyn TrayService>) -> Self
pub fn tray(self, tray: Arc<dyn TrayService>) -> Self
Give the application a system tray. Products without a tray never call this
and get None — modules that need one see it through the platform.
Sourcepub fn http_client(self, http: Arc<dyn HttpClient>) -> Self
pub fn http_client(self, http: Arc<dyn HttpClient>) -> Self
Give the application an HTTP client.
One client for the whole application: it owns the connection pool, and several would defeat keep-alive (ADR-0014).
Sourcepub fn connector(self, connector: impl Connector) -> Self
pub fn connector(self, connector: impl Connector) -> Self
Register a connector.
The set of external services a build can reach is fixed here, at compile time, and is therefore auditable (ADR-0006).
Sourcepub fn workspace_fs(self, workspace_fs: Arc<dyn WorkspaceFs>) -> Self
pub fn workspace_fs(self, workspace_fs: Arc<dyn WorkspaceFs>) -> Self
Give the application a workspace filesystem adapter (B2).
Sourcepub fn workspace_watcher(
self,
workspace_watcher: Arc<dyn WorkspaceWatcher>,
) -> Self
pub fn workspace_watcher( self, workspace_watcher: Arc<dyn WorkspaceWatcher>, ) -> Self
Give the application a workspace watcher adapter (B3).
Sourcepub fn process_runner(self, process_runner: Arc<dyn ProcessRunner>) -> Self
pub fn process_runner(self, process_runner: Arc<dyn ProcessRunner>) -> Self
Give the application a process runner adapter (B1).
Sourcepub fn global_shortcuts(
self,
global_shortcuts: Arc<dyn GlobalShortcutService>,
) -> Self
pub fn global_shortcuts( self, global_shortcuts: Arc<dyn GlobalShortcutService>, ) -> Self
Give the application a global shortcut service adapter (B5).