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 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).