Skip to main content

Platform

Struct Platform 

Source
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: Jobs

Background jobs: progress, cancellation, uniform lifecycle.

§sync: SyncEngine

Decides when registered sync targets run.

§accounts: AccountService

Connected accounts across all connectors.

§connectors: ConnectorRegistry

The 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

Source

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.

Source

pub fn opener(&self) -> Result<Arc<dyn Opener>>

The URL opener, or a permission error.

Source

pub fn workspace_fs(&self) -> Result<Arc<dyn WorkspaceFs>>

The workspace filesystem, or a configuration error naming what is missing.

Source

pub fn workspace_watcher(&self) -> Result<Arc<dyn WorkspaceWatcher>>

The workspace watcher, or a configuration error naming what is missing.

Source

pub fn process_runner(&self) -> Result<Arc<dyn ProcessRunner>>

The process runner, or a configuration error naming what is missing.

Source

pub fn global_shortcuts(&self) -> Result<Arc<dyn GlobalShortcutService>>

The global shortcut service, or a configuration error naming what is missing.

Trait Implementations§

Source§

impl Clone for Platform

Source§

fn clone(&self) -> Platform

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Platform

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more