pub struct Platform {Show 19 fields
pub clock: Arc<dyn Clock>,
pub events: EventBus,
pub storage: Arc<dyn Storage>,
pub cache: Cache,
pub secrets: Arc<dyn SecretStore>,
pub settings: Settings,
pub notifications: Arc<dyn NotificationService>,
pub confirmation: Arc<dyn ConfirmationService>,
pub tray: Option<Arc<dyn TrayService>>,
pub jobs: Jobs,
pub sync: SyncEngine,
pub accounts: AccountService,
pub connectors: ConnectorRegistry,
pub opener: Option<Arc<dyn Opener>>,
pub http: Option<Arc<dyn HttpClient>>,
pub workspace_fs: Option<Arc<dyn WorkspaceFs>>,
pub workspace_watcher: Option<Arc<dyn WorkspaceWatcher>>,
pub process_runner: Option<Arc<dyn ProcessRunner>>,
pub global_shortcuts: Option<Arc<dyn GlobalShortcutService>>,
}Expand description
The platform services every module may rely on.
Cloning is cheap and shares the same instances.
Optional fields are capabilities the product did not grant. They are None because
the composition root left them out, not because they are switched off at runtime —
a build that cannot reach the network is a build that cannot reach the network.
Fields§
§clock: Arc<dyn Clock>§events: EventBus§storage: Arc<dyn Storage>§cache: Cache§secrets: Arc<dyn SecretStore>§settings: Settings§notifications: Arc<dyn NotificationService>§confirmation: Arc<dyn ConfirmationService>Human confirmation for mutating operations. The deny-all default keeps MCP safe by construction; only products with a real prompt override it.
tray: Option<Arc<dyn TrayService>>The system tray handle, present only when the product declared it.
jobs: JobsBackground jobs: progress, cancellation, uniform lifecycle.
sync: SyncEngineDecides when registered sync targets run.
accounts: AccountServiceConnected accounts across all connectors.
connectors: ConnectorRegistryThe connectors this build was compiled with.
opener: Option<Arc<dyn Opener>>Present only when the product declared the capability to open external URLs.
http: Option<Arc<dyn HttpClient>>Present only when the product talks to external services.
workspace_fs: Option<Arc<dyn WorkspaceFs>>Present only when the product grants workspace filesystem access (B2).
workspace_watcher: Option<Arc<dyn WorkspaceWatcher>>Present only when the product watches workspace filesystem changes (B3).
process_runner: Option<Arc<dyn ProcessRunner>>Present only when the product allows executing external processes (B1).
global_shortcuts: Option<Arc<dyn GlobalShortcutService>>Present only when the product registers global shortcuts (B5).
Implementations§
Source§impl Platform
impl Platform
Sourcepub fn http(&self) -> Result<Arc<dyn HttpClient>>
pub fn http(&self) -> Result<Arc<dyn HttpClient>>
The HTTP client, or a configuration error naming what is missing.
Modules call this instead of unwrapping the field, so a product that forgot to wire a client gets an actionable message rather than a panic.
Sourcepub fn workspace_fs(&self) -> Result<Arc<dyn WorkspaceFs>>
pub fn workspace_fs(&self) -> Result<Arc<dyn WorkspaceFs>>
The workspace filesystem, or a configuration error naming what is missing.
Sourcepub fn workspace_watcher(&self) -> Result<Arc<dyn WorkspaceWatcher>>
pub fn workspace_watcher(&self) -> Result<Arc<dyn WorkspaceWatcher>>
The workspace watcher, or a configuration error naming what is missing.
Sourcepub fn process_runner(&self) -> Result<Arc<dyn ProcessRunner>>
pub fn process_runner(&self) -> Result<Arc<dyn ProcessRunner>>
The process runner, or a configuration error naming what is missing.
Sourcepub fn global_shortcuts(&self) -> Result<Arc<dyn GlobalShortcutService>>
pub fn global_shortcuts(&self) -> Result<Arc<dyn GlobalShortcutService>>
The global shortcut service, or a configuration error naming what is missing.